Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
|
|
|
| 42 |
except TimeoutError:
|
| 43 |
-
|
|
|
|
| 44 |
except Exception as e:
|
| 45 |
-
|
|
|
|
| 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:
|