Muhammad Waqas commited on
Commit
78e3b99
·
1 Parent(s): 07755fc

Added: Generate image to video

Browse files
Files changed (1) hide show
  1. app.py +9 -17
app.py CHANGED
@@ -408,18 +408,10 @@ def get_video(prompt_id):
408
  return jsonify({'error': str(e)}), 500
409
 
410
  # Route: Image to Video old
411
- @app.route('/image_to_video_old', methods=['POST'])
412
- def image_to_video_old():
413
  data = request.json
414
 
415
- time.sleep(1000)
416
- # Prepare the response with the video URL
417
- response_data = {
418
- 'message': 'Video generated successfully'
419
- }
420
-
421
- return jsonify(response_data), 200
422
-
423
  # Extract and validate token
424
  token = request.headers.get('Authorization')
425
  if not token or not token.startswith("Bearer "):
@@ -489,8 +481,8 @@ def image_to_video_old():
489
  prompt_id = queue_prompt(workflow, token)
490
 
491
  # Wait for workflow execution to complete
492
- last_ping = time.time() # Track the last ping time
493
- PING_INTERVAL = 30 # Send a ping every 30 seconds
494
 
495
  # Wait for workflow execution to complete
496
  while True:
@@ -530,12 +522,12 @@ def image_to_video_old():
530
  video_url = f"https://gosign-de-comfyui-api.hf.space/{local_video_path}"
531
 
532
  # Prepare the response with the video URL
533
- response_data = {
534
- 'video_url': video_url,
535
- 'message': 'Video generated successfully'
536
- }
537
 
538
- return jsonify(response_data), 200
539
 
540
  # Send the video as an HTTP response
541
  response = send_file(
 
408
  return jsonify({'error': str(e)}), 500
409
 
410
  # Route: Image to Video old
411
+ @app.route('/v1/image_to_video', methods=['POST'])
412
+ def v1_image_to_video():
413
  data = request.json
414
 
 
 
 
 
 
 
 
 
415
  # Extract and validate token
416
  token = request.headers.get('Authorization')
417
  if not token or not token.startswith("Bearer "):
 
481
  prompt_id = queue_prompt(workflow, token)
482
 
483
  # Wait for workflow execution to complete
484
+ last_ping = time.time()
485
+ PING_INTERVAL = 30
486
 
487
  # Wait for workflow execution to complete
488
  while True:
 
522
  video_url = f"https://gosign-de-comfyui-api.hf.space/{local_video_path}"
523
 
524
  # Prepare the response with the video URL
525
+ # response_data = {
526
+ # 'video_url': video_url,
527
+ # 'message': 'Video generated successfully'
528
+ # }
529
 
530
+ # return jsonify(response_data), 200
531
 
532
  # Send the video as an HTTP response
533
  response = send_file(