DmitrMakeev commited on
Commit
3839853
·
verified ·
1 Parent(s): 5e7bd99

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -656,7 +656,14 @@ def upload_file_to_memory():
656
  def get_last_image():
657
  if latest_image["data"] is None:
658
  return jsonify({"error": "No image available"}), 404
 
 
659
  latest_image["data"].seek(0)
 
 
 
 
 
660
  return send_file(latest_image["data"], mimetype='image/jpeg', download_name=latest_image["filename"])
661
 
662
 
 
656
  def get_last_image():
657
  if latest_image["data"] is None:
658
  return jsonify({"error": "No image available"}), 404
659
+
660
+ # Создаем копию потока
661
  latest_image["data"].seek(0)
662
+ image_copy = BytesIO(latest_image["data"].read())
663
+ image_copy.seek(0)
664
+
665
+ return send_file(image_copy, mimetype='image/jpeg', download_name=latest_image["filename"])
666
+
667
  return send_file(latest_image["data"], mimetype='image/jpeg', download_name=latest_image["filename"])
668
 
669