Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📖 Interactive AI Storyteller Machine 🎙️✨

An interactive, choose-your-own-adventure style story generator powered by LangChain + Groq (Llama 3.3 70B). It dynamically branches narratives based on user-defined configurations and choices, generating real-time scene illustrations and voice narrations.


🔗 Live Submission Links


🛠️ System Architecture

The application orchestrates narrative flow, visual generation, and audio rendering in a single runtime loop:

graph TD
    A[Streamlit Web UI] -->|1. Setup Config / User Choices| B[Story Engine - LangChain + Groq]
    B -->|2. Generate Passage & 3 Options| A
    A -->|3. Trigger Image Generation| C[Pollinations.ai Image API]
    C -->|4. Return Scene Illustration URL| A
    A -->|5. Trigger Voice Narration| D[gTTS - Google Text-to-Speech]
    D -->|6. Stream Narration Audio| A
    A -->|7. Export Full Story| E[Local Text File Download]
Loading

🌟 Core Features

1. Dynamic Branching & Story Setup

  • Defines custom story parameters: Genre, Tone, Protagonist Name, Supporting Characters, and Core Premise.
  • Generates 3 dynamic, contextual choice prompts after every passage, with an additional "Type Your Own Direction" text box for total creative freedom.
  • Ends the adventure gracefully with a user-controlled ending option.

2. Live Scene Illustration

  • Auto-generates high-fidelity scene images for every generated passage using the Pollinations.ai keyless text-to-image API.
  • Allows user-configured toggles to enable/disable image loading for slower connections.

3. Voice Narration (TTS)

  • Narrates the generated passage in real-time using Google Text-to-Speech (gTTS).
  • Offers audio-playing controls right on the UI with simple toggles.

4. Memory & Continuity

  • Leverages LangChain's memory states to preserve previous story paths, character details, and narrative consistency.
  • Allows users to download the complete story log as a .txt file upon ending the game.

🛠️ Tech Stack

Layer Technology
Frontend/UI Streamlit
LLM Orchestration LangChain
Inference Engine Groq Cloud API (Llama 3.3 70B)
Image Generation Pollinations.ai API
Text-to-Speech gTTS (Google Text-to-Speech)
Configuration Dotenv (Python-dotenv)

📁 Project Structure

ai_storyteller/
├── app.py             # Streamlit UI & layout definitions
├── story_engine.py    # LangChain prompt templates & Groq API routing
├── image_gen.py       # Pollinations.ai image query helper
├── tts.py             # Audio conversion and gTTS file handling
├── requirements.txt   # Declared package dependencies
├── .env.example       # Sample environment template
├── .gitignore         # Excludes secret credentials
└── README.md          # Project documentation

🚀 Setup & Run

1. Install Dependencies

git clone https://github.com/VimalN2005/AI-Storyteller-Machine.git
cd AI-Storyteller-Machine
pip install -r requirements.txt

2. Configure Environment Variables

Copy .env.example to .env and fill in your free Groq API key:

GROQ_API_KEY=your_groq_api_key_here

3. Run the Application Locally

streamlit run app.py

📝 Resume Blurb

AI Storyteller Machine: Built an interactive choose-your-own-adventure story generator using LangChain + Groq Llama 3.3. Orchestrated dynamic branching story paths based on user preferences, integrating the Pollinations.ai API for on-the-fly scene illustrations and gTTS for automated voice narration.

About

An AI-powered storytelling application that transforms ideas into engaging, creative, and personalized stories using intelligent text generation.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages