Inspiration

Parents are tired, and screens (blue light) disrupt children's sleep. We wanted to bring back the magic of audio storytelling. MagicStory solves this: it uses AI to invent the perfect bedtime story instantly, narrated by a soothing voice, so kids can dream with their eyes closed.

What it does

It turns any child into the hero of their own adventure.

Input: Child's name, age, a companion (e.g., a dragon), and a moral theme.

AI Magic: Gemini generates a safe, age-appropriate tale.

Neural Audio: The app converts text into lifelike speech (not a robot voice!) using neural TTS.

How we built it

We built a full-stack Python app using Streamlit.

The Brain: Google Gemini for fast, creative story generation.

The Voice: Edge-TTS for high-quality, natural-sounding audio.

The Look: Custom CSS for a cozy "Night Mode" book aesthetic.

Challenges we ran into

The "Robot" Voice: My first prototype used a standard TTS library, and it sounded terrible. Finding a way to integrate a Neural voice (Edge-TTS) and making it work asynchronously with Streamlit was a tough technical hurdle.

The Quota Error (429): I started using the experimental Gemini 2.0 model. It worked great locally, but I quickly hit the RESOURCE_EXHAUSTED error. I learned the hard way that stability is key in production! I migrated to Gemini 1.5 Flash, which proved to be much more reliable.

Deployment: Moving from localhost to the cloud was tricky (handling requirements.txt, managing API secrets securely).

Accomplishments that we're proud of

The Audio Quality: I am incredibly proud of how "human" the storytelling sounds. It breathes, pauses, and feels real.

The Speed: From typing a name to hearing the story, it takes less than 10 seconds.

The UI: I managed to make a Streamlit app look like a storybook, not a data dashboard.

What we learned

I learned a lot about prompt engineering (how to prevent AI from generating scary villains for a 3-year-old!). I also learned how to manage Python's asynchronous/await functions in a synchronous framework like Streamlit. I also learned not to give up on my project and to keep believing in it despite all the difficulties. I learned how to integrate Gemini into Python code with voice that tells the story.

What's next for Magic Story

Illustration: I plan to integrate an image generation API to create a cover art for each story.

Library: Adding a "Save" feature so children can replay their favorite generated tales.

Multi-language: Allowing the app to tell stories in Spanish, English, or German to help kids learn new languages.

Built With

  • css3
  • edge-tts
  • google-gemini
  • markdown
  • pyton
  • streamlit
  • text-to-speech
Share this project:

Updates