def phylab():
response = {'succeed': 0}
try:
captcha_file = request.files['captcha']
except Exception as e:
response['reason'] = "cannot fetch the image file, please post it with key 'captcha'."
return json.dumps(response)
if not allowed_file(captcha_file.filename):
response['reason'] = "this file type is no supported."
return json.dumps(response)
try:
im = Image.open(captcha_file)
predict = solve_phylab(im)
except Exception as e:
response['reason'] = "an error occurred: %s" % str(e)
else:
response['succeed'] = 1
response['result'] = predict
return json.dumps(response)
app.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录