saemstunes commited on
Commit
b533522
ยท
verified ยท
1 Parent(s): 7e62f1e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +213 -2
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: ๐Ÿ’ฌ
4
  colorFrom: yellow
5
  colorTo: purple
6
  sdk: gradio
7
- sdk_version: 5.42.0
8
  app_file: app.py
9
  pinned: false
10
  hf_oauth: true
@@ -14,4 +14,215 @@ license: mit
14
  short_description: 'Lightweight Saemโ€™s Tunes assistant โ€” Phi-3.5-mini-instruct '
15
  ---
16
 
17
- An example chatbot using [Gradio](https://gradio.app), [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/v0.22.2/en/index), and the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  colorFrom: yellow
5
  colorTo: purple
6
  sdk: gradio
7
+ sdk_version: 5.47.2
8
  app_file: app.py
9
  pinned: false
10
  hf_oauth: true
 
14
  short_description: 'Lightweight Saemโ€™s Tunes assistant โ€” Phi-3.5-mini-instruct '
15
  ---
16
 
17
+ # ๐ŸŽต Saem's Tunes AI Assistant
18
+
19
+ Advanced AI-powered assistant for Saem's Tunes music platform, built with Microsoft Phi-3.5-mini-instruct and comprehensive monitoring.
20
+
21
+ ## ๐ŸŒŸ Features
22
+
23
+ - **Smart FAQ System**: AI-powered responses with contextual understanding
24
+ - **Multi-Platform Deployment**: Hugging Face Spaces, Railway, and local deployment
25
+ - **Continuous Learning**: Improves over time with user feedback
26
+ - **Advanced RAG**: Semantic search through your music database
27
+ - **Real-time Monitoring**: Comprehensive performance analytics
28
+ - **Production Ready**: Security, rate limiting, and error handling
29
+
30
+ ## ๐Ÿš€ Quick Start
31
+
32
+ ### Option 1: Hugging Face Spaces (Recommended - Free)
33
+ 1. **Create a Space** at [huggingface.co/spaces](https://huggingface.co/spaces)
34
+ 2. **Upload these files** to your Space:
35
+ - `app.py` (main application)
36
+ - `requirements.txt` (dependencies)
37
+ - `models/phi3.5-mini.Q4_K_M.gguf` (download instructions below)
38
+ 3. **Set environment variables** in Space settings:
39
+ - `SUPABASE_URL`: Your Supabase project URL
40
+ - `SUPABASE_ANON_KEY`: Your Supabase anon key
41
+ 4. **Deploy** and your AI assistant will be live!
42
+
43
+ ### Option 2: Railway Deployment
44
+ 1. **Connect your GitHub repo** to [Railway](https://railway.app)
45
+ 2. **Set environment variables** in Railway dashboard
46
+ 3. **Deploy automatically** from your repository
47
+
48
+ ### Option 3: Local Development
49
+ ```bash`
50
+ # Clone and setup
51
+ git clone <your-repo>
52
+ cd saems-tunes-ai
53
+
54
+ # Install dependencies
55
+ pip install -r requirements.txt
56
+
57
+ # Download the model
58
+ mkdir -p models
59
+ cd models
60
+ wget https://huggingface.co/Thetima4/Phi-3.5-mini-instruct-Q4_K_M-GGUF/resolve/main/Phi-3.5-mini-instruct-q4_k_m.gguf
61
+
62
+ # Run locally
63
+ python app.py
64
+ ๐Ÿ“ฆ Model Download
65
+ The system uses Microsoft Phi-3.5-mini-instruct quantized to Q4_K_M for optimal performance.
66
+
67
+ # Download Command:
68
+ bash
69
+ wget -O models/phi3.5-mini.Q4_K_M.gguf \
70
+ "https://huggingface.co/Thetima4/Phi-3.5-mini-instruct-Q4_K_M-GGUF/resolve/main/Phi-3.5-mini-instruct-q4_k_m.gguf"
71
+ Alternative Models:
72
+ Q4_0: Faster, slightly lower quality
73
+
74
+ Q5_K_M: Better quality, larger size
75
+
76
+ Q8_0: Best quality, largest size
77
+
78
+ ๐Ÿ”ง Configuration
79
+ # Environment Variables:
80
+ bash
81
+ SUPABASE_URL=your_supabase_project_url
82
+ SUPABASE_ANON_KEY=your_supabase_anon_key
83
+ HF_SPACE_URL=your_huggingface_space_url
84
+ MODEL_PATH=./models/phi3.5-mini.Q4_K_M.gguf
85
+ # Supabase Schema:
86
+ Your database should include these tables (see supabase_schema.sql):
87
+
88
+ songs - Music catalog
89
+
90
+ artists - Artist information
91
+
92
+ users - User profiles
93
+
94
+ ai_interactions - AI conversation logging
95
+
96
+ ๐ŸŽฏ Integration with Your React App
97
+ Add the AI component to your existing React app:
98
+
99
+ javascript
100
+ // In your main App.js
101
+ import SaemsTunesAI from './components/SaemsTunesAI';
102
+
103
+ function App() {
104
+ return (
105
+ <div className="App">
106
+ {/* Your existing components */}
107
+ <SaemsTunesAI />
108
+ </div>
109
+ );
110
+ }
111
+ ๐Ÿ“Š Monitoring & Analytics
112
+ The system includes comprehensive monitoring:
113
+
114
+ Real-time Dashboard: Streamlit-based analytics
115
+
116
+ Performance Metrics: Response times, error rates, token usage
117
+
118
+ Alert System: Email/Slack notifications for issues
119
+
120
+ Usage Analytics: User behavior and model performance
121
+
122
+ Access the dashboard at /dashboard when running locally.
123
+
124
+ ๐Ÿ”’ Security Features
125
+ Rate Limiting: Prevents API abuse
126
+
127
+ Input Sanitization: Protects against injection attacks
128
+
129
+ Audit Logging: Tracks all user interactions
130
+
131
+ Content Filtering: Detects suspicious queries
132
+
133
+ ๐Ÿ”„ Continuous Learning
134
+ The system improves over time by:
135
+
136
+ Collecting feedback from user interactions
137
+
138
+ Fine-tuning on successful conversations
139
+
140
+ Automated model updates without downtime
141
+
142
+ ๐Ÿ—๏ธ Architecture
143
+ text
144
+ Frontend (React) โ†’ AI API (FastAPI) โ†’ Phi-3.5 Model โ†’ Supabase Database
145
+ โ†‘
146
+ Monitoring & Analytics
147
+ Components:
148
+ Frontend: React component with chat interface
149
+
150
+ Backend: FastAPI server with model inference
151
+
152
+ Database: Supabase for music data and analytics
153
+
154
+ Monitoring: Comprehensive metrics and alerts
155
+
156
+ ๐Ÿšจ Troubleshooting
157
+ Common Issues:
158
+ Model not loading:
159
+
160
+ Verify the model file exists in models/
161
+
162
+ Check file permissions
163
+
164
+ Ensure enough RAM (4GB+ recommended)
165
+
166
+ Supabase connection issues:
167
+
168
+ Verify environment variables
169
+
170
+ Check Supabase project status
171
+
172
+ Test database connection
173
+
174
+ High response times:
175
+
176
+ Use smaller quantization (Q4_0 instead of Q8_0)
177
+
178
+ Increase allocated resources
179
+
180
+ Enable GPU acceleration if available
181
+
182
+ Getting Help:
183
+ Check the Hugging Face discussion forum
184
+
185
+ Open an issue in this repository
186
+
187
+ Contact the Saem's Tunes development team
188
+
189
+ ๐Ÿ“ˆ Performance Benchmarks
190
+ Model Size Response Time Quality Use Case
191
+ Q4_K_M 2.4GB 1-3s Excellent Production
192
+ Q4_0 2.2GB 1-2s Very Good Fast responses
193
+ Q8_0 4.2GB 3-5s Best Maximum quality
194
+ ๐Ÿ”ฎ Future Enhancements
195
+ Voice interface integration
196
+
197
+ Mobile app companion
198
+
199
+ Advanced music recommendation engine
200
+
201
+ Multi-language support (Swahili focus)
202
+
203
+ Band collaboration features
204
+
205
+ ๐Ÿ‘ฅ Contributing
206
+ We welcome contributions! Please see:
207
+
208
+ Code of Conduct
209
+
210
+ Contributing Guidelines
211
+
212
+ Issue Templates
213
+
214
+ ๐Ÿ“„ License
215
+ This project is licensed under the MIT License - see the LICENSE file for details.
216
+
217
+ ๐Ÿ™ Acknowledgments
218
+ Microsoft for the Phi-3.5 model
219
+
220
+ Hugging Face for model hosting and Spaces
221
+
222
+ Supabase for the database backend
223
+
224
+ Railway for deployment infrastructure
225
+
226
+ Built with โค๏ธ for the Saem's Tunes community
227
+
228
+ Visit Saem's Tunes | Report an Issue