app.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:anti-captcha.shuosc.org 作者: shuopensourcecommunity 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号