mythforge-comic-generator / demo_automatic_comic.py
emailvenky's picture
Upload 27 files
4b19c49 verified
"""
Demo: Fully Automatic Comic Generation
User provides ONLY a text prompt - system does everything automatically
"""
from character_consistency_manager import CharacterConsistencyManager
def demo_yogi_auto():
"""Demo: Automatic yogi story with surprise character"""
print("="*70)
print(" DEMO: FULLY AUTOMATIC COMIC GENERATION")
print(" User provides ONE sentence - System does EVERYTHING")
print("="*70)
manager = CharacterConsistencyManager()
# User's simple prompt - that's ALL they provide!
user_prompt = "A yogi teaching a young aspirant the rules of meditation and mindfulness leading to levitation by his own example in a beautiful vibrant colorful jungle"
print(f"\nπŸ“ User Input:")
print(f' "{user_prompt}"')
print(f"\nπŸ€– System will automatically:")
print(f" 1. Extract all characters (Yogi, Aspirant)")
print(f" 2. Add a surprise character for intrigue")
print(f" 3. Generate detailed descriptions for each")
print(f" 4. Create reference sheets for each character")
print(f" 5. Break story into 3 panels")
print(f" 6. Generate all panels with consistent characters")
print(f"\nStarting automatic generation...\n")
# ONE LINE OF CODE!
result = manager.generate_comic_from_prompt(
story_prompt=user_prompt,
num_panels=3,
art_style="manga",
include_surprise_character=True
)
print("\n" + "="*70)
print(" RESULTS")
print("="*70)
print(f"\nCharacters automatically created:")
for char_name in result["characters"].keys():
if char_name == result["surprise_character"]:
print(f" 🎁 {char_name} (SURPRISE!)")
else:
print(f" πŸ“– {char_name}")
print(f"\nPanels generated: {len(result['panels'])}")
for panel_info in result["panel_info"]:
print(f" Panel {panel_info['panel_number']}: {', '.join(panel_info['characters'])}")
print(f" File: {panel_info['filename']}")
print(f"\nβœ… Complete comic saved to: {result['output_dir']}")
def demo_custom_story():
"""Demo: User provides their own story"""
print("\n" + "="*70)
print(" CUSTOM STORY DEMO")
print("="*70)
manager = CharacterConsistencyManager()
print("\nπŸ“ Enter your story idea (or press Enter for default):")
print(" Example: A wizard teaching magic to an apprentice in a castle")
user_story = input("\n> ").strip()
if not user_story:
user_story = "A wise old wizard teaching a young apprentice powerful magic spells in an ancient castle library, accidentally summoning something unexpected"
print(f"\nπŸ€– Generating comic from: '{user_story}'")
result = manager.generate_comic_from_prompt(
story_prompt=user_story,
num_panels=3,
art_style="fantasy",
include_surprise_character=True
)
print(f"\nβœ… Comic saved to: {result['output_dir']}")
def compare_before_after():
"""Show the difference: Manual vs Automatic"""
print("\n" + "="*70)
print(" COMPARISON: MANUAL vs AUTOMATIC")
print("="*70)
print("\n❌ OLD WAY (Manual - Lots of code):")
print("""
manager = CharacterConsistencyManager()
# User has to manually specify EVERYTHING
yogi = manager.create_character(
"Elderly yogi, white beard, saffron robes...",
"Master Yogi",
"manga"
)
aspirant = manager.create_character(
"Young boy, short hair, white clothes...",
"Young Aspirant",
"manga"
)
# Manually generate each panel
panel1 = manager.generate_panel_with_character(...)
panel2 = manager.generate_panel_with_multiple_characters(...)
panel3 = manager.generate_panel_with_multiple_characters(...)
# ~20+ lines of code, character hardcoding
""")
print("\nβœ… NEW WAY (Automatic - ONE line):")
print("""
manager = CharacterConsistencyManager()
# User just provides a story prompt!
result = manager.generate_comic_from_prompt(
"A yogi teaching a young aspirant meditation and levitation in a jungle"
)
# Done! System automatically:
# - Extracted: Yogi, Aspirant
# - Added: Surprise character (e.g., Forest Spirit)
# - Generated: All character sheets
# - Created: 3 consistent panels
# - Saved: Everything to disk
# Just 1 line of code!
""")
print("\nπŸš€ Benefit: 95% less code, 100% automatic!")
def main():
print("\n" + "="*70)
print(" AUTOMATIC COMIC GENERATION DEMOS")
print(" No hardcoding - Just provide a story prompt!")
print("="*70)
print("\nSelect demo:")
print(" 1. Yogi Story (automatic with surprise character)")
print(" 2. Custom Story (enter your own idea)")
print(" 3. Show Comparison (Manual vs Automatic)")
print(" 4. Run all demos")
print("="*70)
choice = input("\nEnter choice (1-4): ").strip()
if choice == "1":
demo_yogi_auto()
elif choice == "2":
demo_custom_story()
elif choice == "3":
compare_before_after()
elif choice == "4":
compare_before_after()
input("\nPress Enter to run Yogi demo...")
demo_yogi_auto()
input("\nPress Enter to run Custom Story...")
demo_custom_story()
else:
print("Invalid choice!")
print("\n" + "="*70)
print(" βœ… DEMO COMPLETE")
print("="*70)
if __name__ == "__main__":
main()