mirror of
https://github.com/guilhermewerner/image-caption-api
synced 2025-06-15 22:54:17 +00:00
Update main.py
This commit is contained in:
@ -51,9 +51,6 @@ def caption_image():
|
|||||||
@app.route('/caption-base64', methods=['POST'])
|
@app.route('/caption-base64', methods=['POST'])
|
||||||
def caption_image_base64():
|
def caption_image_base64():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
|
|
||||||
print(data)
|
|
||||||
|
|
||||||
if 'image_base64' in data:
|
if 'image_base64' in data:
|
||||||
image_base64 = re.sub('^data:image/.+;base64,', '', data['image_base64'])
|
image_base64 = re.sub('^data:image/.+;base64,', '', data['image_base64'])
|
||||||
image_data = base64.b64decode(image_base64)
|
image_data = base64.b64decode(image_base64)
|
||||||
@ -65,7 +62,5 @@ def caption_image_base64():
|
|||||||
else:
|
else:
|
||||||
return jsonify({"error": "Missing 'image_base64'"}), 400
|
return jsonify({"error": "Missing 'image_base64'"}), 400
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(host='0.0.0.0', port=5885, debug=True)
|
app.run(host='0.0.0.0', port=5885, debug=True)
|
||||||
|
Reference in New Issue
Block a user