INNER CODE UNIT · Python
detection_json
chonyy/AI-basketball-analysis · app.py:23
def detection_json():
if request.method == 'POST':
response = []
f = request.files['image']
# create a secure filename
filename = secure_filename(f.filename)
print("filename", filename)
# save file to /static/uploads
filepath = os.path.join(app.config['UPLOAD_FOLDER'], filename)
print("filepath", filepath)
f.save(filepath)
detectionAPI(response, filepath)
print(response)
try:
return jsonify(response), 200
except FileNotFoundError:
abort(404)