breezywaves commited on
Commit
ca8cc77
·
verified ·
1 Parent(s): 0637f4a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -26,8 +26,8 @@ def generate_video(input_text):
26
  timeout=180 # Increase timeout to 3 minutes
27
  )
28
 
29
- # Add UI feedback
30
- yield "Starting video generation... (this may take a few minutes)"
31
 
32
  try:
33
  # Generate the video
@@ -38,11 +38,14 @@ def generate_video(input_text):
38
  with open(temp_path, "wb") as f:
39
  f.write(video_bytes)
40
 
41
- return temp_path
 
42
  except TimeoutError:
43
- return "Model is still warming up. Please try again in a few minutes."
 
44
  except Exception as e:
45
- return f"Error: {str(e)}"
 
46
 
47
  # Set up Gradio interface
48
  with gr.Blocks() as demo:
 
26
  timeout=180 # Increase timeout to 3 minutes
27
  )
28
 
29
+ # Add UI feedback - returning None for video and status message for text
30
+ yield None, "Starting video generation... (this may take a few minutes)"
31
 
32
  try:
33
  # Generate the video
 
38
  with open(temp_path, "wb") as f:
39
  f.write(video_bytes)
40
 
41
+ # Return both the video path and a success message
42
+ return temp_path, "Video generation complete!"
43
  except TimeoutError:
44
+ # Return None for video and error message for text
45
+ return None, "Model is still warming up. Please try again in a few minutes."
46
  except Exception as e:
47
+ # Return None for video and error message for text
48
+ return None, f"Error: {str(e)}"
49
 
50
  # Set up Gradio interface
51
  with gr.Blocks() as demo: