Skip to content

Instantly share code, notes, and snippets.

@Sachin-crypto
Created November 14, 2022 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sachin-crypto/7c3625d155f672c3d8166037fe6b261b to your computer and use it in GitHub Desktop.
Save Sachin-crypto/7c3625d155f672c3d8166037fe6b261b to your computer and use it in GitHub Desktop.
# Prediction route
@app.route('/prediction', methods=['POST'])
def predict_image_file():
try:
if request.method == 'POST':
img = preprocess_img(request.files['file'].stream)
pred = predict_result(img)
return render_template("result.html", predictions=str(pred))
except:
error = "File cannot be processed."
return render_template("result.html", err=error)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment