Spaces:
Running
Running
Create test_generator.py
Browse files- test_generator.py +48 -0
test_generator.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Test script for the Professional Cartoon Film Generator
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import os
|
| 7 |
+
import sys
|
| 8 |
+
from app import ProfessionalCartoonFilmGenerator
|
| 9 |
+
|
| 10 |
+
def test_generator():
|
| 11 |
+
"""Test the generator with a simple script"""
|
| 12 |
+
|
| 13 |
+
print("π§ͺ Testing Professional Cartoon Film Generator...")
|
| 14 |
+
|
| 15 |
+
# Initialize generator
|
| 16 |
+
generator = ProfessionalCartoonFilmGenerator()
|
| 17 |
+
|
| 18 |
+
# Test script
|
| 19 |
+
test_script = """
|
| 20 |
+
A brave young explorer discovers a magical forest where talking animals
|
| 21 |
+
help her find an ancient treasure that will save their enchanted home
|
| 22 |
+
from eternal winter.
|
| 23 |
+
""".strip()
|
| 24 |
+
|
| 25 |
+
print(f"π Test script: {test_script}")
|
| 26 |
+
print("\n㪠Starting generation...")
|
| 27 |
+
|
| 28 |
+
try:
|
| 29 |
+
# Generate the film
|
| 30 |
+
final_video, script_data, status = generator.generate_professional_cartoon_film(test_script)
|
| 31 |
+
|
| 32 |
+
print(f"\nπ Status: {status}")
|
| 33 |
+
|
| 34 |
+
if final_video and os.path.exists(final_video):
|
| 35 |
+
print(f"β
Success! Video saved to: {final_video}")
|
| 36 |
+
print(f"π File size: {os.path.getsize(final_video) / (1024*1024):.1f} MB")
|
| 37 |
+
return True
|
| 38 |
+
else:
|
| 39 |
+
print("β No video generated")
|
| 40 |
+
return False
|
| 41 |
+
|
| 42 |
+
except Exception as e:
|
| 43 |
+
print(f"β Test failed with error: {e}")
|
| 44 |
+
return False
|
| 45 |
+
|
| 46 |
+
if __name__ == "__main__":
|
| 47 |
+
success = test_generator()
|
| 48 |
+
sys.exit(0 if success else 1)
|