Spaces:
Running
Running
Pravin Barapatre
Pin dependencies for Hugging Face Spaces compatibility and remove submodule issue
db8251f
#!/usr/bin/env python3 | |
""" | |
Demo script for text-to-video generation | |
This script demonstrates how to use the text-to-video generator with a simple example. | |
""" | |
import os | |
import sys | |
from simple_generator import generate_video_from_text | |
def main(): | |
print("Text-to-Video Generation Demo") | |
print("=" * 40) | |
# Demo prompt | |
demo_prompt = "A beautiful butterfly flying through a colorful garden with flowers" | |
print(f"Generating video for prompt: '{demo_prompt}'") | |
print("This may take a few minutes depending on your hardware...") | |
print() | |
try: | |
# Generate video with default settings | |
output_path = generate_video_from_text( | |
prompt=demo_prompt, | |
model_id="damo-vilab/text-to-video-ms-1.7b", # Fast model for demo | |
num_frames=16, | |
fps=8, | |
num_inference_steps=20, # Reduced for faster demo | |
guidance_scale=7.5, | |
seed=42, # Fixed seed for reproducible demo | |
output_path="demo_video.mp4" | |
) | |
print("=" * 40) | |
print("Demo completed successfully!") | |
print(f"Video saved as: {output_path}") | |
print() | |
print("You can now:") | |
print("1. Open the video file to view the result") | |
print("2. Run 'python text_to_video.py' for the web interface") | |
print("3. Try different prompts with 'python simple_generator.py'") | |
except Exception as e: | |
print(f"Error during demo: {str(e)}") | |
print() | |
print("Troubleshooting tips:") | |
print("- Make sure all dependencies are installed: pip install -r requirements.txt") | |
print("- Check if you have sufficient disk space") | |
print("- Ensure you have a stable internet connection for model download") | |
print("- Try running with CPU if GPU memory is insufficient") | |
return 1 | |
return 0 | |
if __name__ == "__main__": | |
exit(main()) |