Spaces:
Build error
Apply for a GPU community grant: Company project
Build Luganda singing pipeline for BeatDrop Studio using Makerere/Sunbird + RVC.
Create API route /api/luganda-sing:
Input: { lyrics: string, style: "kidandali"|"afrobeats"|"ballad", use_my_voice: boolean }
Step A - Get perfect Luganda pronunciation:
POST https://api-inference.huggingface.co/models/Sunbird/sunbird-lug-tts
Headers: { Authorization: "Bearer " + process.env.HF_TOKEN, "Content-Type": "application/json" }
Body: { inputs: lyrics }
Response is audio/wav - save as /tmp/base.wavStep B - If use_my_voice = true AND model sylus256/luganda-beatdrop exists:
POST https://api-inference.huggingface.co/models/sylus256/luganda-beatdrop
Headers same as above
Send base.wav as file with parameters: { f0_up_key: 0, index_rate: 0.75, filter_radius: 3 }
This converts Sunbird speech to your singing voice
Else: use base.wav directlyStep C - Return JSON: { audio_url: data:audio/wav;base64,..., source: "sunbird+rvc" }
Update /studio page:
- Add textarea "Lyrics in Luganda" with placeholder "Nkwagala nyo BeatDrop..."
- Add toggle "Sing with my voice" (default ON)
- Add dropdown style: Kidandali, Afrobeats, Ballad
- Button "Generate Luganda Singing" calls /api/luganda-sing
- Show audio player + download button
- Show credit: "Powered by Makerere Sunbird AI + BeatDrop Voice"
Cache results in Supabase table 'generations':
- columns: id, user_id, lyrics, style, audio_url, created_at
- If same lyrics+style exists in last 24h, return cached
Add fallback: If Sunbird model is loading (503), retry 3 times with 5s delay, show "Makerere model warming up..."
IMPORTANT: Log each step to console for debugging.