How nkmohit/fableforgeai-storyengine works
Project type and purpose
• From the README and file‐tree, this is a full-stack, single-repo Python application serving a Streamlit-based front end and integrating with external AI services (Google Gemini, Hugging Face).
• Purpose: an AI-powered story-engine and chatbot platform that lets users generate text stories, comic videos, audio narration, grammar-checks, translations, etc.
File structure
• Top level:
• main.py → Streamlit application entrypoint (UI router + controllers)
• gemini_utility.py → Helper module encapsulating all calls to Google Gemini API
• install.py → Automated installer and environment-bootstrapper
• requirements.txt→ Dependency list
• UPGRADE_GUIDE.md→ Migration notes (deployment concerns)
• README.md → Project overview and usage instructions
• No separate “frontend” or “backend” directories—UI and business logic cohabit under main.py, calls broken out into gemini_utility.py.
README for additional insights
• Tech stack: Python 3.9+, Streamlit UI, google-generativeai SDK for Gemini, python-dotenv, Hugging Face REST API for audio, Pillow, NumPy.
• Workflow: Users interact via web UI → Streamlit routes to feature handlers → handlers call gemini_utility or other HTTP clients → responses streamed back to UI.
a. Main components
• Client Browser (end-user)
• Streamlit App (main.py)
– UI Components: ChatBot, Story Generator, Comic Video Generator, AI Assistant
– Controller/Router
• Business Logic Modules
– gemini_utility.py (Gemini API wrapper)
– Audio module (calls Hugging Face via requests)
• Configuration Store
– .env file (API keys for Google Gemini & Hugging Face)
• External Services
– Google Gemini API
– Hugging Face TTS API
b. Component relationships & data flow
1. User → (HTTP/WebSocket) → Streamlit UI
2. Streamlit UI → internal controller → appropriate feature handler
3. Handler → gemini_utility → Google Gemini → back to handler
4. Handler → Audio module → Hugging Face → back to handler
5. Handler → UI streaming response → User
6. install.py (one-time) reads/writes .env, installs dependencies
c. Architectural patterns and design principles
• Modular feature separation (UI vs. API wrapper)
• Single process, event-driven web application (Streamlit)
• External service integration layer (gemini_utility)
• Configuration decoupling via environment variables
d. Key technologies & libraries
• Streamlit (UI framework)
• google-generativeai (Gemini SDK)
• requests (Hugging Face REST)
• python-dotenv (.env config)
• Pillow, NumPy (image preprocessing, media handling)