How mohit6304/fableforgeai-storyengine works
Project type and purpose
• This is a Python-based, full-stack web application built with Streamlit.
• Purpose: Provide three AI-powered content-creation features—ChatBot, Story Generator, and Comic Video Generator—by orchestrating calls to Google’s Gemini AI models and HuggingFace services.
File structure
• Top level:
• main.py → Streamlit entry point (routes UI requests to different features)
• gemini_utility.py → Wrapper module encapsulating all calls to Gemini-Pro, Gemini-Pro-Vision, embeddings, Gradio Client, and TTS
• requirements.txt → Declares Python dependencies (streamlit, openai, transformers, gradio-client, python-dotenv, etc.)
• .gitignore → Standard exclusions (e.g., .env)
• There is no separate “frontend” folder because Streamlit handles the UI in main.py.
README for architectural clues
• Streamlit UI
• Business-logic layer (gemini_utility)
• External AI services (Gemini APIs, HuggingFace, Gradio video generator, TTS)
• Describes three feature modules (ChatBot, Story Generator, Comic Video Generator).
1. Streamlit Frontend (main.py UI layer)
2. Business Logic Layer (feature controllers inside main.py)
3. AI Service Wrapper (gemini_utility.py)
4. External Services:
– Gemini-Pro Text API
– Gemini-Pro-Vision Image API
– HuggingFace Embeddings API
– Gradio Client Video Generation
– Text-to-Speech Engine (e.g., pyttsx3 or external TTS API)
5. Configuration Store (.env)
• User interacts with Streamlit UI → triggers a feature controller in main.py
• Controller calls corresponding functions in gemini_utility → passes user input (text / image)
• gemini_utility forwards requests → External AI services
• AI services return responses → gemini_utility post-processes (e.g., assemble story, synthesize audio, build comic frames/video)
• Post-processed data flows back → Controller → UI renders text, audio player, or embeds video
c. Architectural patterns & design principles:
• MVC-style separation: Streamlit UI (View), main.py controllers (Controller), gemini_utility (Model/Service)
• Single Responsibility: Each feature (ChatBot/Story/Video) is a distinct flow in controllers calling generic wrapper methods
• External Service Abstraction: gemini_utility centralizes all API integrations
• Configuration Management: .env keys are loaded once at startup
d. Key technologies & libraries:
– Python 3.7+
– Streamlit for UI
– python-dotenv for environment configuration
– HTTP/REST clients (requests or openai SDK) for Gemini APIs
– HuggingFace transformers or API client for embeddings
– gradio-client for video generation
– Any TTS library or external service