Spaces:
Sleeping
Sleeping
Muhammad Waqas
commited on
Commit
·
74393b1
1
Parent(s):
01fbb1a
Added: Generate image to video
Browse files
app.py
CHANGED
|
@@ -339,10 +339,11 @@ def image_to_video():
|
|
| 339 |
return jsonify({'message': 'Unbale to connect to the server. Make sure the server is running', 'error': str(e)}), 500
|
| 340 |
|
| 341 |
finally:
|
|
|
|
| 342 |
# Always delete the image if it was saved
|
| 343 |
-
if image_path and os.path.exists(image_path):
|
| 344 |
-
|
| 345 |
-
|
| 346 |
|
| 347 |
# Get video route
|
| 348 |
@app.route('/get_video/<prompt_id>', methods=['GET'])
|
|
@@ -391,9 +392,9 @@ def get_video(prompt_id):
|
|
| 391 |
return jsonify({'error': 'Failed to retrieve video data.'}), 500
|
| 392 |
|
| 393 |
# Save the video locally
|
| 394 |
-
local_video_path = f"static/generated_image_to_video_{prompt_id}.mp4"
|
| 395 |
-
with open(local_video_path, 'wb') as f:
|
| 396 |
-
|
| 397 |
|
| 398 |
# Send the video as an HTTP response
|
| 399 |
return send_file(
|
|
|
|
| 339 |
return jsonify({'message': 'Unbale to connect to the server. Make sure the server is running', 'error': str(e)}), 500
|
| 340 |
|
| 341 |
finally:
|
| 342 |
+
pass
|
| 343 |
# Always delete the image if it was saved
|
| 344 |
+
# if image_path and os.path.exists(image_path):
|
| 345 |
+
# os.remove(image_path)
|
| 346 |
+
# print(f"Deleted temporary image: {image_path}", flush=True)
|
| 347 |
|
| 348 |
# Get video route
|
| 349 |
@app.route('/get_video/<prompt_id>', methods=['GET'])
|
|
|
|
| 392 |
return jsonify({'error': 'Failed to retrieve video data.'}), 500
|
| 393 |
|
| 394 |
# Save the video locally
|
| 395 |
+
# local_video_path = f"static/generated_image_to_video_{prompt_id}.mp4"
|
| 396 |
+
# with open(local_video_path, 'wb') as f:
|
| 397 |
+
# f.write(video_data)
|
| 398 |
|
| 399 |
# Send the video as an HTTP response
|
| 400 |
return send_file(
|