Spaces:
Sleeping
Sleeping
| license: mit | |
| title: Ibi-Voice Translation Backend | |
| sdk: gradio | |
| emoji: π | |
| colorFrom: blue | |
| colorTo: pink | |
| short_description: JR Digital Insights - Professional English to Ibibio transla | |
| sdk_version: 5.35.0 | |
| # π― Ibi-Voice Translation Backend | |
| **JR Digital Insights** - AI-powered Ibibio translation service on Hugging Face Spaces | |
| ## π Quick Setup | |
| ### 1. Get Your API Keys | |
| #### Groq API Key (Free) | |
| 1. Go to [console.groq.com](https://console.groq.com) | |
| 2. Sign up/login | |
| 3. Navigate to "API Keys" | |
| 4. Create new key | |
| 5. Copy the key (starts with `gsk_...`) | |
| #### Tavily Search API Key (Free Tier) | |
| 1. Go to [tavily.com](https://tavily.com) | |
| 2. Sign up for free account | |
| 3. Get your API key from dashboard | |
| 4. Copy the key (starts with `tvly-...`) | |
| ### 2. Configure Hugging Face Space | |
| 1. In your HF Space, click **"Settings"** tab | |
| 2. Scroll to **"Repository secrets"** | |
| 3. Add these secrets: | |
| ``` | |
| Name: GROQ_API_KEY | |
| Value: your_groq_key_here | |
| Name: TAVILY_API_KEY | |
| Value: your_tavily_key_here | |
| ``` | |
| 4. Click **"Add secret"** for each | |
| ### 3. Upload Files | |
| Upload these files to your HF Space: | |
| - `app.py` (main backend code) | |
| - `requirements.txt` (dependencies) | |
| - `README.md` (this file) | |
| ## π API Usage | |
| ### Frontend Integration | |
| ```javascript | |
| // Connect your Ibi-Voice frontend to this backend | |
| async function translateOnline(query) { | |
| const response = await fetch('https://your-username-ibi-voice-backend.hf.space/api/predict', { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ | |
| data: [query], | |
| fn_index: 0 // First function in Gradio interface | |
| }) | |
| }); | |
| const result = await response.json(); | |
| return result.data[0]; | |
| } | |
| // Usage example | |
| translateOnline("What is 'God is good' in Ibibio?") | |
| .then(translation => console.log(translation)); | |
| ``` | |
| ### Direct API Call | |
| ```bash | |
| curl -X POST "https://your-username-ibi-voice-backend.hf.space/api/predict" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{ | |
| "data": ["What is God is good in Ibibio?"], | |
| "fn_index": 0 | |
| }' | |
| ``` | |
| ## π§ Features | |
| - **π§ AI Reasoning**: Uses Groq LLaMA3-8B for intelligent translation analysis | |
| - **π Web Search**: Real-time lookup via Tavily API for current information | |
| - **π Local Dictionary**: Built-in fallback for common Ibibio phrases | |
| - **π― Smart Combining**: Merges all sources for best possible translation | |
| ## π Testing Queries | |
| Try these example queries: | |
| - "What is 'God is good' in Ibibio?" | |
| - "How do you say 'thank you' in Ibibio?" | |
| - "Translate 'good morning' to Ibibio" | |
| - "What does 'sosongo' mean in English?" | |
| ## π― Next Steps | |
| 1. Deploy this backend to HF Spaces | |
| 2. Test the API endpoints | |
| 3. Integrate with your Ibi-Voice React frontend | |
| 4. Add more local dictionary entries as needed | |
| --- | |
| **Built for JR Digital Insights** | Ibibio Language Preservation Project |