An innovative storytelling platform that leverages cutting-edge AI technology to create engaging, interactive narratives.
Supports multiple story genres, dynamic character creation, and real-time collaborative storytelling.
One-click FREE deployment of your personalized story generator.
Live Demo · Documentation · Issues · Contributing
Share Interactive Story Generator
🌟 Revolutionizing creative storytelling through AI collaboration. Built for writers, creators, and storytelling enthusiasts.
Important
This project demonstrates modern AI-powered storytelling with real-time generation, multiple genre support, and collaborative narrative development. It combines Gradio's intuitive interface with Hugging Face's powerful language models to provide an engaging storytelling experience.
📑 Table of Contents
- 🎭 Interactive Story GeneratorAI-Powered Collaborative Storytelling Platform - TOC -
Tip
Experience the intuitive interface and powerful features of our AI storytelling platform.
2024-12-14.16-24-38.mp4
We are passionate about combining cutting-edge AI technology with creative storytelling. The Interactive Story Generator empowers users to create engaging narratives through intelligent AI collaboration, offering multiple genres, dynamic characters, and real-time story development.
Whether you're a creative writer, educator, or storytelling enthusiast, this platform provides an innovative playground for narrative exploration. The project is actively developed and welcomes community feedback for any issues encountered.
Note
- Python 3.8+ required
- Hugging Face API token required for AI model access
- Gradio for intuitive web interface
- Real-time story generation capabilities
| No installation required! Experience AI storytelling immediately. | |
|---|---|
| Join our community! Star us to stay updated with new features and releases. |
Tip
⭐ Star us to receive all release notifications and support the project's development!
⭐ Star History
Experience next-generation storytelling with our advanced AI system powered by Hugging Face's Zephyr-7B-Beta model. The platform delivers coherent, engaging narratives that adapt to your creative input and maintain story continuity across multiple interactions.
Key capabilities include:
- 🤖 Advanced AI Model: Powered by HuggingFace Zephyr-7B-Beta
- 🔄 Real-time Generation: Streaming story development
- 🧠 Context Awareness: Maintains story coherence and character consistency
- 🎯 Adaptive Storytelling: Responds intelligently to user input
Choose from diverse story genres and themes to match your creative vision. Our platform supports comprehensive customization options for different storytelling styles.
Available Genres:
- 🏰 Fantasy: Magical worlds and mythical creatures
- 🚀 Science Fiction: Futuristic technology and space exploration
- 🔍 Mystery: Puzzles, investigations, and suspenseful plots
- 🗡️ Adventure: Thrilling journeys and heroic quests
- 💕 Romance: Emotional connections and relationship dynamics
- 👻 Horror: Supernatural elements and thrilling suspense
Story Themes:
- Adventure, Mystery, Romance, Historical, Slice of Life, Fairy Tale
Build compelling characters using expert-designed templates or create custom personalities from scratch. Our character system helps develop rich personalities that drive your story forward.
Character Templates:
- 🗡️ Adventurer: Brave explorers who love challenges
- 🔍 Detective: Keen investigators with sharp observation skills
- 🎨 Artist: Creative individuals with unique perspectives
- 🔬 Scientist: Curious researchers dedicated to discovery
- 👤 Ordinary Person: Relatable characters with rich inner worlds
Beyond core storytelling, the platform includes:
- 🎛️ Advanced Controls: Fine-tune creativity, coherence, and length
- 💾 Story Management: Save and export your creative works
- 🔄 Real-time Interaction: Continuous dialogue with AI
- 📊 Parameter Control: Adjust temperature, max tokens, and sampling
- 🎨 Intuitive Interface: User-friendly Gradio-based design
- 📱 Responsive Design: Works seamlessly across devices
- 🔧 Customizable Settings: Tailor the experience to your preferences
- 📖 Built-in Guidance: Comprehensive usage instructions
✨ More features are continuously being added based on community feedback.
Core Technologies:
- Language: Python 3.8+ for robust backend processing
- Interface: Gradio 4.44.1 for intuitive web interface
- AI Engine: Hugging Face Hub 0.25.2 for model access
- Deep Learning: PyTorch 2.2.1 for neural network operations
- NLP: Transformers 4.38.2 for advanced language processing
Key Libraries:
- Environment Management: python-dotenv for configuration
- Model Integration: HuggingFace Zephyr-7B-Beta for story generation
- Real-time Streaming: Gradio's streaming capabilities
- Error Handling: Comprehensive logging and retry mechanisms
Tip
Each technology was selected for production readiness, ease of use, and seamless integration with AI language models.
g
8000
raph TB
subgraph "User Interface"
A[Gradio Web Interface] --> B[Story Controls]
B --> C[Character Settings]
C --> D[Parameter Controls]
end
subgraph "Core Engine"
E[Story Generator] --> F[AI Model Client]
F --> G[Context Manager]
G --> H[Response Processor]
end
subgraph "AI Services"
I[HuggingFace Hub]
J[Zephyr-7B-Beta Model]
K[Streaming API]
end
subgraph "Storage"
L[Story Files]
M[User Sessions]
N[Configuration]
end
A --> E
F --> I
I --> J
J --> K
E --> L
A --> M
D --> N
sequenceDiagram
participant U as User
participant G as Gradio Interface
participant S as Story Generator
participant H as HuggingFace API
participant M as AI Model
U->>G: Input Story Parameters
G->>S: Process Story Request
S->>H: Send Prompt to API
H->>M: Forward to Zephyr Model
M->>H: Stream Response
H->>S: Return Generated Text
S->>G: Update Story Display
G->>U: Show Real-time Story
Important
Ensure you have the following installed:
- Python 3.8 or higher (Download)
- pip package manager
- Git (Download)
- Hugging Face account and API token (Get Token)
1. Clone Repository
git clone https://github.com/ChanMeng666/interactive-story-generator.git
cd interactive-story-generator2. Install Dependencies
# Install required packages
pip install -r requirements.txt3. Environment Setup
# Create environment file
touch .env
# Add your Hugging Face token
echo "HF_TOKEN=your_hugging_face_token_here" >> .env4. Run Application
python app.py🎉 Success! Open http://localhost:7860 to start creating stories.
Create a .env file with the following variables:
# Required: Hugging Face API Token
HF_TOKEN=your_hugging_face_token_here
# Optional: Custom model endpoint
MODEL_ENDPOINT=HuggingFaceH4/zephyr-7b-beta
# Optional: Application settings
APP_PORT=7860
APP_HOST=localhost
DEBUG_MODE=falseTip
Get your Hugging Face token from https://huggingface.co/settings/tokens
One-Click Deployment:
Manual Deployment:
- Create a new Space on Hugging Face
- Upload your code files
- Add your
HF_TOKENto Space secrets - Configure Space settings for Gradio app
Development Mode:
# Run with auto-reload
python app.py
# Run with specific port
python app.py --port 7860Production Mode:
# Install production dependencies
pip install gunicorn
# Run with Gunicorn
gunicorn app:demo.app --bind 0.0.0.0:7860| Variable | Description | Required | Default | Example |
|---|---|---|---|---|
HF_TOKEN |
Hugging Face API token | ✅ | - | hf_xxxxxxxxxxxxx |
MODEL_ENDPOINT |
AI model endpoint | 🔶 | HuggingFaceH4/zephyr-7b-beta |
Custom model path |
APP_PORT |
Application port | 🔶 | 7860 |
8080 |
DEBUG_MODE |
Enable debug logging | 🔶 | false |
true |
Note
✅ Required, 🔶 Optional
Getting Started:
- Choose Story Style - Select from Fantasy, Sci-Fi, Mystery, Adventure, Romance, or Horror
- Pick Theme - Choose Adventure, Mystery, Romance, Historical, Slice of Life, or Fairy Tale
- Create Character - Use templates or custom descriptions
- Describe Scene - Set the initial story environment
- Generate Story - Click "✨ Start Story" to begin
- Continue Narrative - Interact with AI to develop the plot
Story Generation Process:
# Example story generation flow
story_params = {
"style": "Fantasy",
"theme": "Adventure",
"character": "A brave knight seeking ancient treasures",
"scene": "A mysterious forest at dawn"
}
# AI generates opening based on parameters
# User provides input to continue story
# AI maintains context and continues narrativeParameter Controls:
-
Temperature (0.1-2.0): Controls creativity vs coherence
- Lower values (0.1-0.7): More focused, consistent output
- Higher values (0.8-2.0): More creative, varied output
-
Max Tokens (64-1024): Controls response length
- Lower values: Concise responses
- Higher values: Detailed, elaborate responses
-
Top-p (0.1-1.0): Controls vocabulary diversity
- Lower values: More predictable word choices
- Higher values: More varied vocabulary
Character Templates:
CHARACTER_TEMPLATES = {
"Adventurer": "A brave and fearless explorer who loves adventure and challenges.",
"Detective": "A keen and observant detective skilled in observation and deduction.",
"Artist": "A creative artist with unique perspectives on beauty.",
"Scientist": "A curious scientist dedicated to exploring the unknown.",
"Ordinary Person": "An ordinary person with a rich inner world."
}Story Styles & Themes:
- Fantasy: Magical realms, mythical creatures, epic quests
- Science Fiction: Future technology, space exploration, AI
- Mystery: Puzzles, investigations, hidden secrets
- Adventure: Thrilling journeys, heroic challenges
- Romance: Emotional connections, relationship dynamics
- Horror: Supernatural elements, suspenseful atmosphere
Setup Development Environment:
# Clone repository
git clone https://github.com/ChanMeng666/interactive-story-generator.git
cd interactive-story-generator
# Install development dependencies
pip install -r requirements.txt
# Run in development mode
python app.pyDevelopment Scripts:
# Start development server
python app.py
# Run with debug mode
DEBUG_MODE=true python app.py
# Test story generation
python -c "from app import generate_story; print(list(generate_story('test scene', 'Fantasy', 'Adventure', 'test character')))"Project Structure:
interactive-story-generator/
├── app.py #
729A
Main application file
├── requirements.txt # Python dependencies
├── .env # Environment variables
├── stories/ # Generated story files
├── public/ # Static assets
│ └── interactive-story-generator-logo.svg
├── README.md # Project documentation
├── LICENSE # Apache 2.0 License
└── CODE_OF_CONDUCT.md # Community guidelines
We welcome contributions! Here's how you can help improve the Interactive Story Generator:
Ways to Contribute:
- 🐛 Bug Reports: Help identify and fix issues
- 💡 Feature Requests: Suggest new capabilities
- 📚 Documentation: Improve guides and examples
- 🔧 Code Contributions: Submit pull requests
- 🎨 UI/UX Improvements: Enhance user experience
Development Process:
- Fork the Repository
- Create Feature Branch:
git checkout -b feature/amazing-feature - Make Changes: Follow coding standards
- Add Tests: Ensure functionality works
- Submit PR: Include clear description
Contribution Guidelines:
- Follow Python PEP 8 style guidelines
- Add docstrings for new functions
- Include tests for new features
- Update documentation as needed
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
License Benefits:
- ✅ Commercial use allowed
- ✅ Modification allowed
- ✅ Distribution allowed
- ✅ Private use allowed
|
Chan Meng Creator & Lead Developer |
Contact Information:
GitHub: ChanMeng666
LinkedIn: chanmeng666
Email: chanmeng.dev@gmail.com
Portfolio: chanmeng.live
Empowering creativity through intelligent collaboration
⭐ Star us on GitHub • 📖 Read the Documentation • 🐛 Report Issues • 💡 Request Features • 🤝 Contribute
Made with ❤️ by Chan Meng