Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| Create Example Images for Character Forge Documentation | |
| ======================================================== | |
| Licensed under GNU AGPL v3.0 | |
| This script helps create example images for the README and documentation. | |
| It generates examples for each major feature. | |
| """ | |
| import os | |
| import sys | |
| from pathlib import Path | |
| print("="*70) | |
| print("Character Forge - Example Generator") | |
| print("="*70) | |
| # Check for API key | |
| api_key = os.environ.get("GEMINI_API_KEY") | |
| if not api_key: | |
| print("\nβ ERROR: GEMINI_API_KEY not set!") | |
| print("\nPlease set your API key:") | |
| print(" Windows: set GEMINI_API_KEY=your-key-here") | |
| print(" Linux/Mac: export GEMINI_API_KEY=your-key-here") | |
| print("\nGet a free API key at: https://aistudio.google.com/app/apikey") | |
| sys.exit(1) | |
| print(f"\nβ API Key found: {api_key[:10]}...") | |
| # Create examples directory | |
| examples_dir = Path("docs/examples") | |
| examples_dir.mkdir(parents=True, exist_ok=True) | |
| print(f"β Examples directory: {examples_dir.absolute()}") | |
| print("\n" + "="*70) | |
| print("MANUAL GENERATION INSTRUCTIONS") | |
| print("="*70) | |
| print(""" | |
| To create the example images, follow these steps: | |
| 1. START THE APP | |
| ------------------ | |
| cd D:/hu/character_forge/character_forge_image | |
| streamlit run app.py | |
| 2. ENTER YOUR API KEY | |
| ------------------ | |
| - Look at the sidebar | |
| - Enter your API key in the "Gemini API Key" field | |
| 3. GENERATE CHARACTER FORGE EXAMPLE | |
| ---------------------------------- | |
| Page: π₯ Character Forge | |
| Option A - Use Text Prompt: | |
| Prompt: "A young female elf warrior with long silver hair and | |
| green eyes, wearing leather armor, fantasy RPG character | |
| design, detailed portrait, high quality" | |
| Option B - Upload Initial Image: | |
| - Find or generate a character portrait first | |
| - Upload it to Character Forge | |
| - Let it generate 5 views | |
| Click: "Generate Character Sheet" | |
| Wait: ~2-3 minutes | |
| Save: Download the final character sheet | |
| Name: character_forge_output.png | |
| 4. GENERATE COMPOSITION EXAMPLE | |
| ---------------------------- | |
| Page: π¬ Composition Assistant | |
| Upload Image 1: | |
| - Type: "Subject/Character" | |
| - Prompt: "Female warrior in leather armor" | |
| Upload Image 2: | |
| - Type: "Background/Environment" | |
| - Prompt: "Medieval castle courtyard at sunset" | |
| Composition Prompt: "Warrior standing confidently in castle | |
| courtyard, epic fantasy scene, cinematic | |
| lighting, dramatic atmosphere" | |
| Click: "Generate Composition" | |
| Wait: ~30 seconds | |
| Save: Download the result | |
| Name: composition_output.png | |
| 5. GENERATE STANDARD EXAMPLE | |
| -------------------------- | |
| Page: πΈ Standard Interface | |
| Prompt: "A majestic blue dragon flying over snowy mountain | |
| peaks at golden hour, fantasy art, dramatic lighting, | |
| volumetric clouds, 4k digital art" | |
| Aspect Ratio: 16:9 (1344x768) | |
| Temperature: 0.5 | |
| Click: "Generate Image" | |
| Wait: ~30 seconds | |
| Save: Download the result | |
| Name: standard_output.png | |
| 6. SAVE ALL IMAGES | |
| --------------- | |
| Save all generated images to: | |
| D:/hu/character_forge/docs/examples/ | |
| Required files: | |
| - character_forge_output.png (the 5-view character sheet) | |
| - composition_output.png (composed scene) | |
| - standard_output.png (dragon landscape) | |
| 7. VERIFY FILE SIZES | |
| ----------------- | |
| After saving, run this script again to verify! | |
| """) | |
| print("\n" + "="*70) | |
| print("CHECKING FOR EXISTING EXAMPLES...") | |
| print("="*70) | |
| required_files = [ | |
| "character_forge_output.png", | |
| "composition_output.png", | |
| "standard_output.png" | |
| ] | |
| found = [] | |
| missing = [] | |
| for filename in required_files: | |
| filepath = examples_dir / filename | |
| if filepath.exists(): | |
| size_mb = filepath.stat().st_size / (1024 * 1024) | |
| print(f"β {filename} ({size_mb:.2f} MB)") | |
| found.append(filename) | |
| else: | |
| print(f"β {filename} (not found)") | |
| missing.append(filename) | |
| print("\n" + "="*70) | |
| if missing: | |
| print(f"STATUS: {len(found)}/{len(required_files)} examples ready") | |
| print("="*70) | |
| print("\nNext steps:") | |
| print("1. Follow the instructions above to generate missing examples") | |
| print("2. Save them to: docs/examples/") | |
| print("3. Run this script again to verify") | |
| else: | |
| print("β ALL EXAMPLES READY!") | |
| print("="*70) | |
| print("\nNext steps:") | |
| print("1. Run: python update_readme_with_examples.py") | |
| print("2. Review the updated README.md") | |
| print("3. Commit and push to HuggingFace") | |
| print("\n" + "="*70) | |
| print("ESTIMATED COST") | |
| print("="*70) | |
| print("Character Forge: ~$0.15 (5 images)") | |
| print("Composition: ~$0.03 (1 image)") | |
| print("Standard: ~$0.03 (1 image)") | |
| print("-----------------------------------") | |
| print("TOTAL: ~$0.21") | |
| print("="*70) | |