agharsallah
commited on
Commit
Β·
3ce05f0
1
Parent(s):
ea5af73
update readme
Browse files- .env.example +20 -4
- .gitattributes +1 -0
- README.md +78 -30
- app.py +5 -1
.env.example
CHANGED
@@ -1,5 +1,21 @@
|
|
1 |
# Local development environment variables - rename to .env
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# Local development environment variables - rename to .env
|
2 |
+
|
3 |
+
# Used for story generation and text manipulation
|
4 |
+
SAMBANOVA_API_KEY="your-sambanova-api-key-here"
|
5 |
+
MISTRAL_API_KEY ="your-mistral-api-key-here"
|
6 |
+
MISTRAL_MODEL="your-mistral-model-here"
|
7 |
+
|
8 |
+
# used for image generation models
|
9 |
+
NEBIUS_API_KEY="your-nebius-api-key-here"
|
10 |
+
NEBIUS_ENDPOINT="your-nebius-endpoint-here"
|
11 |
+
|
12 |
+
# Replace the URLs with your actual Modal hosted Audio model URLs
|
13 |
+
AUDIO_GENERATION_URL="your-audio-generation-url-here"
|
14 |
+
MELODY_GENERATION_URL="your-melody-generation-url-here"
|
15 |
+
|
16 |
+
MCP_SERVER_URL="your-mcp-server-url-here"
|
17 |
+
|
18 |
+
#Used to test mcp function calling
|
19 |
+
OPENAI_API_KEY="your-openai-api-key-here"
|
20 |
+
#Used to Parse the PDFs for story enrichment
|
21 |
+
LLAMA_CLOUD_API_KEY="your-llama-cloud-api-key-here"
|
.gitattributes
CHANGED
@@ -35,3 +35,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
37 |
*.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
37 |
*.png filter=lfs diff=lfs merge=lfs -text
|
38 |
+
*.gif filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -1,47 +1,95 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
sdk_version: 5.32.1
|
8 |
app_file: app.py
|
9 |
-
pinned:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
---
|
11 |
|
12 |
-
#
|
13 |
|
14 |
-
|
15 |
-
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
- Child's interests
|
20 |
-
- Subject of the story
|
21 |
-
- Optional PDF document for additional context
|
22 |
|
23 |
-
|
24 |
|
25 |
-
|
|
|
|
|
26 |
|
27 |
-
|
28 |
-
1. Through the Gradio web interface in the "API Settings" section
|
29 |
-
2. For environment variable check .env.example, and create a `.env` file in the root
|
30 |
|
31 |
-
|
32 |
|
33 |
-
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
```
|
38 |
|
39 |
-
|
40 |
|
41 |
-
|
42 |
-
python app.py
|
43 |
-
```
|
44 |
|
45 |
-
|
46 |
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
title: Magic Tales
|
3 |
+
emoji: π
|
4 |
+
colorFrom: #e1ebd2
|
5 |
+
colorTo: #a7d569
|
6 |
sdk: gradio
|
7 |
sdk_version: 5.32.1
|
8 |
app_file: app.py
|
9 |
+
pinned: True
|
10 |
+
thumbnail: assets/images/wizard.png
|
11 |
+
description: |
|
12 |
+
Magic Tales is a Gradio application that uses a range of LLMs and tools to create personalized, immersive stories for children. Customize story types, tones, and more to spark imagination and creativity!
|
13 |
+
Track: agent-demo-track
|
14 |
+
keywords:
|
15 |
+
- gradio
|
16 |
+
- Modal
|
17 |
+
- Nebius
|
18 |
+
- sambanova
|
19 |
+
- mistral
|
20 |
+
- llamaindex
|
21 |
+
- Dia-1.6B
|
22 |
+
- Meta musicGen
|
23 |
+
- stories
|
24 |
+
- children
|
25 |
+
- mcp
|
26 |
+
- interactive
|
27 |
+
- pdf
|
28 |
+
- customization
|
29 |
+
- imagination
|
30 |
+
- creativity
|
31 |
+
- agent-demo-track
|
32 |
+
- mcp-server-track
|
33 |
+
repository: agharsallah/magical-tales
|
34 |
---
|
35 |
|
36 |
+
# π Magic Tales: Where Imagination Comes Alive! πβ¨
|
37 |
|
38 |
+
<p align="center">
|
39 |
+
<a href="https://huggingface.co/spaces/agharsallah/magical-tales">
|
40 |
+
<img src="assets/images/wizard.png" alt="Magic Tales" width="220" style="max-width:100%;height:auto;">
|
41 |
+
</a>
|
42 |
+
</p>
|
|
|
|
|
|
|
43 |
|
44 |
+
Welcome to Magic Tales, a Gradio application that harnesses the power of SambaNova API to craft personalized, immersive stories for children. Our app is designed to spark imagination and creativity, offering a wide array of customization options to suit various tastes and preferences:
|
45 |
|
46 |
+
πΉ **Story Crafting**: Choose from diverse story types (Historical, Futuristic, Fantasy), tones (Funny, Enthusiastic, Mysterious), and tailor the narrative based on the child's age, language preference, interests, and the subject of the story.
|
47 |
+
πΉ **Enhanced Context**: Optionally, upload a PDF document to provide additional context for the story, making it even more personalized and relevant.
|
48 |
+
πΉ **Interactive Experience**: Built with Gradio, our application offers an intuitive and interactive user interface, making story generation a delightful experience for both children and parents.
|
49 |
|
50 |
+
## π Getting Started
|
|
|
|
|
51 |
|
52 |
+
### βοΈ Configuration
|
53 |
|
54 |
+
You can configure the app using environment variables. For example, to set the SambaNova API key, you can use the `SAMBANOVA_API_KEY` environment variable:
|
55 |
|
56 |
+
- Through the Gradio web interface in the "API Settings" section
|
57 |
+
- By creating a `.env` file in the root directory (check `.env.example` for reference)
|
|
|
58 |
|
59 |
+
When deploying to Hugging Face Spaces, set this as a Secret in the Settings tab.
|
60 |
|
61 |
+
See the [Gradio documentation](https://github.com/gradio-app/gradio/blob/main/guides/04_additional-features/10_environment-variables.md#_snippet_20) for more information.
|
|
|
|
|
62 |
|
63 |
+
### π§ Setup
|
64 |
|
65 |
+
1. **Installation**: Run the following command to install the required dependencies:
|
66 |
+
```bash
|
67 |
+
pip install -r requirements.txt
|
68 |
+
```
|
69 |
+
|
70 |
+
2. **Running Locally**: Start the application by executing:
|
71 |
+
```bash
|
72 |
+
python app.py
|
73 |
+
```
|
74 |
+
|
75 |
+
## π― Features
|
76 |
+
|
77 |
+
- **π Multi-Language Support**: Generate stories in various languages to cater to a global audience.
|
78 |
+
- **πΆ Audio Narration**: Listen to the generated stories with integrated audio narration for an immersive experience.
|
79 |
+
- **π΅ Background Music**: Enjoy background music while listening to the stories, enhancing the overall experience.
|
80 |
+
- **π¨ Image Generation**: Generate images to accompany the stories, bringing characters and scenes to life.
|
81 |
+
- **π₯οΈ Interactive UI**: User-friendly Gradio interface for seamless story generation.
|
82 |
+
- **π PDF Context Integration**: Enhance story generation with additional context from uploaded PDF documents.
|
83 |
+
- **π Customizable Narratives**: Tailor stories based on story type, tone, child's age, language, interests, and subject.
|
84 |
+
|
85 |
+
## π Demo
|
86 |
+
|
87 |
+
Experience the magic of our Dynamic Story Generator in action! Check out our live demo [here](https://huggingface.co/spaces/agharsallah/magical-tales).
|
88 |
+
|
89 |
+
## π Deployment
|
90 |
+
|
91 |
+
This application is optimized for Hugging Face Spaces. Simply push this repository to a Hugging Face Space and add the `SAMBANOVA_API_KEY` as a Secret in the Space settings.
|
92 |
+
|
93 |
+
## πΈ Screenshots
|
94 |
+
|
95 |
+

|
app.py
CHANGED
@@ -50,7 +50,11 @@ gr.set_static_paths(paths=[Path.cwd().absolute() / "assets/images"])
|
|
50 |
|
51 |
def create_app():
|
52 |
"""Create the main Gradio app for Magic Story Creator"""
|
53 |
-
with gr.Blocks(
|
|
|
|
|
|
|
|
|
54 |
# Header
|
55 |
create_header()
|
56 |
|
|
|
50 |
|
51 |
def create_app():
|
52 |
"""Create the main Gradio app for Magic Story Creator"""
|
53 |
+
with gr.Blocks(
|
54 |
+
css=main_css,
|
55 |
+
theme=gr.themes.Ocean(),
|
56 |
+
title="Magic Tales",
|
57 |
+
) as demo:
|
58 |
# Header
|
59 |
create_header()
|
60 |
|