Skip to content

ajot/story-builder

Repository files navigation

Story Builder

A tiny bedtime story tool for kids. Type in what the story should be about, and it generates a short bedtime story — both the text and an audio narration.

Try it live →

Story Builder

How it works

Enter a character, a rough plot, and hit generate. The app creates a short, kid-friendly bedtime story and reads it aloud. If you like it, listen. If not, regenerate and try again.

Generated Story

Supports English and Hindi

Generate stories in either language. Useful if you're teaching your kid a second language — they hear the words in context and pick up phrases naturally.

Hindi Support

Background music

Optionally generate a short, gentle intro track to set the mood. It's like a little theme song for the story.

Music Generation

Features

  • AI Story Generation — Age-appropriate bedtime stories
  • Text-to-Speech — 21 voice options via ElevenLabs
  • Multilingual — English and Hindi support
  • Background Music — AI-generated ambient tracks
  • Voice Preview — Listen to samples before generating
  • Download — Save narration and music as MP3 files
  • PWA-ready — Add to your phone's home screen

Tech Stack

Setup

1. Clone the repository

git clone https://github.com/ajot/story-builder.git
cd story-builder

2. Create virtual environment

python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

3. Install dependencies

pip install -r requirements.txt

4. Configure environment variables

Create a .env file:

DIGITAL_OCEAN_MODEL_ACCESS_KEY=your_api_key_here

Get your API key from the DigitalOcean Control Panel.

5. Generate voice samples (optional)

Pre-generate voice preview samples:

python scripts/generate_samples.py

6. Run the app

python app.py

Visit http://localhost:8080

Deployment

DigitalOcean App Platform

  1. Push your code to GitHub
  2. Create a new App in DigitalOcean App Platform
  3. Connect your GitHub repository
  4. Add environment variable: DIGITAL_OCEAN_MODEL_ACCESS_KEY
  5. Deploy

The included Dockerfile handles the build configuration.

Project Structure

story-builder/
├── app.py                 # Flask application
├── prompts.py             # AI system prompts
├── requirements.txt       # Python dependencies
├── Dockerfile             # Container configuration
├── templates/
│   └── index.html         # Frontend UI
├── static/
│   └── voice-samples/     # Pre-generated voice previews
└── scripts/
    └── generate_samples.py # Voice sample generator

API Endpoints

Endpoint Method Description
/ GET Main application UI
/generate-story POST Generate a bedtime story
/generate-audio POST Submit TTS job
/audio-status/<id> GET Check TTS job status
/audio-result/<id> GET Get TTS result
/generate-music-prompt POST Generate music description
/generate-sound POST Submit music generation job

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published