Spaces:
Sleeping
Sleeping
File size: 9,593 Bytes
14b0c7b 4cdaca5 65a1cdf 4cdaca5 65a1cdf 4cdaca5 65a1cdf 14b0c7b 4cdaca5 65a1cdf d84da2e 65a1cdf d84da2e 65a1cdf d84da2e 65a1cdf 3a37184 4cdaca5 0df1705 4cdaca5 65a1cdf 4cdaca5 248f723 4cdaca5 0df1705 248f723 4cdaca5 248f723 4cdaca5 3a37184 248f723 4cdaca5 96e89cb 4cdaca5 0df1705 4cdaca5 0df1705 4cdaca5 65a1cdf 4cdaca5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
---
title: AI Radio - Personalized Radio Station
emoji: π΅
colorFrom: purple
colorTo: pink
sdk: gradio
sdk_version: 4.44.1
app_file: app.py
pinned: false
license: mit
short_description: Entertaining AI Radio with LLM as a Host
tags:
- mcp-in-action-track-consumer
- mcp-in-action-track-creative
---
# π΅ AI Radio - Your Personal Radio Station
## π Overview
**AI Radio** is an intelligent, personalized radio station powered by cutting-edge AI technology. It creates a unique listening experience tailored to your preferences, mood, and interests. Built for the **MCP 1st Birthday Competition**, this app demonstrates autonomous agent behavior, MCP integration, and advanced RAG capabilities.
## π¦Ύ Participants
https://huggingface.co/nikimakarov
## Social
https://x.com/nikimakarov/status/1995277463337967838
## Demo on Youtube
https://youtu.be/tAIlor2TieM
## π οΈ Technology Stack
- **Gradio**: Interactive web interface
- **OpenAI GPT-OSS-120B provided by Nebius** : LLM for content generation, host commentary, and reasoning
- **ElevenLabs**: High-quality text-to-speech for voice generation
- **Modal** Youtube-proxy service
- **LlamaIndex**: RAG system for personalized recommendations and user preference management
- **MCP (Model Context Protocol)**: Structured tool servers for modular functionality
- **Python**: Core application logic
- **RSS Feeds**: Real-time news aggregation
## π Acknowledgments
- **Gradio Team** for the beautiful UI framework
- **MCP Team** for the amazing protocol and competition
- **OpenAI** for creating GPT-OSS-120B
- **Modal** for providing servers for proxy
- **Nebius** for providing models API
- **ElevenLabs** for text-to-speech technology
- **LlamaIndex** for RAG capabilities
## π Project Structure
```
ai_radio/
βββ src/ # Source code
β βββ app.py # Main Gradio application
β βββ config.py # Configuration
β βββ radio_agent.py # AI agent logic
β βββ tts_service.py # Text-to-speech service
β βββ rag_system.py # RAG system
β βββ voice_input.py # Voice input handling
β βββ mcp_servers/ # MCP server implementations
βββ docs/ # Documentation files
βββ audio/ # Generated audio files
βββ logs/ # Log files
βββ requirements.txt # Python dependencies
βββ run.py # Application entry point
```
## β¨ Features
### π΅ Personalized Music
- Curated tracks based on your favorite genres and current mood
- Free music recommendations from multiple genres
- Dynamic DJ commentary generated by AI
### π° Custom News Updates
- Real-time news from RSS feeds
- Personalized news based on your interests (technology, world, business, entertainment, science)
- AI-generated news scripts delivered in a conversational style
### ποΈ Podcast Recommendations
- Discover trending podcasts in various categories
- Personalized recommendations based on your interests
- Engaging introductions to each podcast
### π AI-Generated Stories
- Entertaining stories and fascinating fun facts
- Tailored to your interests and mood
- Perfect short-form content between segments
### π€ AI Radio Host
- Charismatic AI host powered by Nebius GPT-OSS-120B
- Personalized greetings and interactions
- Smooth transitions between segments
### πΎ Smart Recommendations (RAG)
- LlamaIndex-powered RAG system learns from your listening history
- Improves recommendations over time
- Stores your preferences and provides insights
## π MCP Competition Requirements
This app fulfills all requirements for **Track 2: MCP in Action**:
β
**Autonomous Agent Behavior**: The Radio Agent demonstrates planning (show planning), reasoning (segment selection based on preferences), and execution (content generation and delivery)
β
**MCP Servers as Tools**: Implements three MCP servers:
- **MusicMCPServer**: Music search and playlist generation
- **NewsMCPServer**: News fetching and curation
- **PodcastMCPServer**: Podcast discovery and recommendations
β
**Gradio App**: Beautiful, intuitive radio station interface
β
**Advanced Features**:
- **RAG System**: Uses LlamaIndex for context-aware recommendations
- **Context Engineering**: Personalizes content based on user preferences and history
- **Streaming Capabilities**: Efficient audio generation and playback
## π Getting Started
### Option 1: Deploy to HuggingFace Spaces (Recommended) π
**Quick Deploy:**
1. **Create a new Space** on [HuggingFace Spaces](https://huggingface.co/spaces)
- SDK: **Gradio**
- Hardware: **CPU** (or GPU if available)
2. **Configure Secrets** (Settings β Secrets):
- `ELEVENLABS_API_KEY` - Your ElevenLabs API key
- `NEBIUS_API_KEY` - Your Nebius API key (for GPT-OSS-120B)
- `LLAMAINDEX_API_KEY` - Optional, for LlamaIndex embeddings
- `OPENAI_API_KEY` - Optional, for OpenAI embeddings fallback
3. **Push your code** to the Space repository
4. **Access your Space** at `https://huggingface.co/spaces/<username>/<space-name>`
π **Detailed deployment guide**: See [DEPLOY_HF.md](DEPLOY_HF.md)
### Option 2: Local Installation
### Prerequisites
- Python 3.9+
- Nebius API key (for GPT-OSS-120B LLM)
- ElevenLabs API key
### Installation
1. Clone the repository:
```bash
git clone <your-repo-url>
cd ai_radio
```
2. Install dependencies:
```bash
pip install -r requirements.txt
```
3. Set up environment variables or edit `src/config.py`:
```bash
export ELEVENLABS_API_KEY="your-key-here"
export NEBIUS_API_KEY="your-key-here"
export LLAMAINDEX_API_KEY="your-key-here"
```
4. Run the app:
```bash
python run.py
```
The app will be available at `http://localhost:7871`
5. Open your browser to `http://localhost:7871`
## π How to Use
### 1οΈβ£ Set Your Preferences
- Go to the **"Your Preferences"** tab
- Enter your name
- Select your favorite music genres
- Choose news topics you're interested in
- Pick podcast categories
- Set your current mood
- Click **"Save Preferences"**
### 2οΈβ£ Start Your Radio
- Navigate to the **"Radio Player"** tab
- Click **"βΆοΈ Start Radio"**
- Enjoy your personalized radio show!
### 3οΈβ£ Controls
- **βΆοΈ Start Radio**: Begin your personalized show
- **βοΈ Next Segment**: Skip to the next segment
- **βΉοΈ Stop**: Pause the radio (you can resume later)
### 4οΈβ£ Track Your Stats
- Visit the **"Your Stats"** tab
- See your listening history and statistics
- The RAG system uses this data to improve recommendations
## π¨ User Interface
The app features a beautiful, modern radio station interface with:
- **Gradient color schemes** for visual appeal
- **Responsive layout** that works on all devices
- **Real-time status updates** showing what's playing
- **Progress tracking** through your show
- **Audio player** with auto-play functionality
## π§ How It Works
### Agent Architecture
The **RadioAgent** is an autonomous AI agent that:
1. **Plans**: Analyzes user preferences and creates a balanced show plan with music, news, podcasts, and stories
2. **Reasons**: Uses the RAG system to make intelligent decisions about content selection
3. **Executes**: Generates content using Nebius GPT-OSS-120B LLM and delivers it via ElevenLabs TTS
### MCP Server Architecture
Three specialized MCP servers provide modular functionality:
```python
# Music Server
- search_music(genre, mood, limit)
- get_personalized_playlist(user_preferences)
# News Server
- fetch_news(category, limit)
- get_personalized_news(user_preferences)
# Podcast Server
- get_trending_podcasts(category, limit)
- get_personalized_podcasts(user_preferences)
```
### RAG System
The RAG system powered by LlamaIndex:
- Stores user preferences and listening history
- Provides context-aware recommendations
- Learns from user behavior over time
- Supports semantic search over user data
## π― Show Planning Algorithm
The agent uses intelligent planning to create a balanced show:
1. **Analyze preferences**: Load user preferences from RAG system
2. **Calculate distribution**: Determine segment ratios (50% music, 20% news, 20% podcasts, 10% stories)
3. **Generate segments**: Use MCP servers to fetch content for each segment
4. **Add personality**: Generate host commentary using Nebius GPT-OSS-120B LLM
5. **Execute**: Convert text to speech and play audio
## π Audio Generation
- **Text-to-Speech**: ElevenLabs API converts host commentary to natural-sounding speech
- **Voice Selection**: Uses the "Rachel" voice by default (customizable)
- **Streaming**: Efficient audio generation and playback
- **Quality**: High-quality MP3 output
## π Personalization
The app learns from your behavior:
- **Preference Storage**: Saves your favorite genres, interests, and moods
- **History Tracking**: Records what you've listened to
- **Recommendation Engine**: Uses RAG to suggest relevant content
- **Adaptive Planning**: Adjusts future shows based on your history
## π Privacy
- All user data is stored locally
- No data is shared with third parties (except API calls to service providers)
- You can clear your history at any time
## π€ Contributing
This is a hackathon submission, but contributions and feedback are welcome!
## π License
MIT License - feel free to use and modify as needed.
## π§ Contact
Built with β€οΈ for the MCP 1st Birthday Competition
Contact: @nikimakarov
---
**Track**: MCP in Action - Consumer Applications
**Tag**: `mcp-in-action-track-consumer`
π΅ **Enjoy your personalized radio experience!** π΅
|