Spaces:
Sleeping
Sleeping
Create README.md
Browse files
README.md
CHANGED
|
@@ -1,13 +1,112 @@
|
|
| 1 |
---
|
| 2 |
-
title: Ibi Voice Backend
|
| 3 |
-
emoji: π
|
| 4 |
-
colorFrom: purple
|
| 5 |
-
colorTo: red
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version: 5.35.0
|
| 8 |
-
app_file: app.py
|
| 9 |
-
pinned: false
|
| 10 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
-
|
|
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
license: mit
|
| 3 |
+
title: Ibi-Voice Translation Backend
|
| 4 |
+
sdk: gradio
|
| 5 |
+
emoji: π
|
| 6 |
+
colorFrom: blue
|
| 7 |
+
colorTo: pink
|
| 8 |
+
short_description: JR Digital Insights - Professional English to Ibibio transla
|
| 9 |
+
---
|
| 10 |
+
# π― Ibi-Voice Translation Backend
|
| 11 |
+
|
| 12 |
+
**JR Digital Insights** - AI-powered Ibibio translation service on Hugging Face Spaces
|
| 13 |
+
|
| 14 |
+
## π Quick Setup
|
| 15 |
+
|
| 16 |
+
### 1. Get Your API Keys
|
| 17 |
+
|
| 18 |
+
#### Groq API Key (Free)
|
| 19 |
+
1. Go to [console.groq.com](https://console.groq.com)
|
| 20 |
+
2. Sign up/login
|
| 21 |
+
3. Navigate to "API Keys"
|
| 22 |
+
4. Create new key
|
| 23 |
+
5. Copy the key (starts with `gsk_...`)
|
| 24 |
+
|
| 25 |
+
#### Tavily Search API Key (Free Tier)
|
| 26 |
+
1. Go to [tavily.com](https://tavily.com)
|
| 27 |
+
2. Sign up for free account
|
| 28 |
+
3. Get your API key from dashboard
|
| 29 |
+
4. Copy the key (starts with `tvly-...`)
|
| 30 |
+
|
| 31 |
+
### 2. Configure Hugging Face Space
|
| 32 |
+
|
| 33 |
+
1. In your HF Space, click **"Settings"** tab
|
| 34 |
+
2. Scroll to **"Repository secrets"**
|
| 35 |
+
3. Add these secrets:
|
| 36 |
+
```
|
| 37 |
+
Name: GROQ_API_KEY
|
| 38 |
+
Value: your_groq_key_here
|
| 39 |
+
|
| 40 |
+
Name: TAVILY_API_KEY
|
| 41 |
+
Value: your_tavily_key_here
|
| 42 |
+
```
|
| 43 |
+
4. Click **"Add secret"** for each
|
| 44 |
+
|
| 45 |
+
### 3. Upload Files
|
| 46 |
+
|
| 47 |
+
Upload these files to your HF Space:
|
| 48 |
+
- `app.py` (main backend code)
|
| 49 |
+
- `requirements.txt` (dependencies)
|
| 50 |
+
- `README.md` (this file)
|
| 51 |
+
|
| 52 |
+
## π API Usage
|
| 53 |
+
|
| 54 |
+
### Frontend Integration
|
| 55 |
+
|
| 56 |
+
```javascript
|
| 57 |
+
// Connect your Ibi-Voice frontend to this backend
|
| 58 |
+
async function translateOnline(query) {
|
| 59 |
+
const response = await fetch('https://your-username-ibi-voice-backend.hf.space/api/predict', {
|
| 60 |
+
method: 'POST',
|
| 61 |
+
headers: { 'Content-Type': 'application/json' },
|
| 62 |
+
body: JSON.stringify({
|
| 63 |
+
data: [query],
|
| 64 |
+
fn_index: 0 // First function in Gradio interface
|
| 65 |
+
})
|
| 66 |
+
});
|
| 67 |
+
|
| 68 |
+
const result = await response.json();
|
| 69 |
+
return result.data[0];
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
// Usage example
|
| 73 |
+
translateOnline("What is 'God is good' in Ibibio?")
|
| 74 |
+
.then(translation => console.log(translation));
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
### Direct API Call
|
| 78 |
+
|
| 79 |
+
```bash
|
| 80 |
+
curl -X POST "https://your-username-ibi-voice-backend.hf.space/api/predict" \
|
| 81 |
+
-H "Content-Type: application/json" \
|
| 82 |
+
-d '{
|
| 83 |
+
"data": ["What is God is good in Ibibio?"],
|
| 84 |
+
"fn_index": 0
|
| 85 |
+
}'
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
## π§ Features
|
| 89 |
+
|
| 90 |
+
- **π§ AI Reasoning**: Uses Groq LLaMA3-8B for intelligent translation analysis
|
| 91 |
+
- **π Web Search**: Real-time lookup via Tavily API for current information
|
| 92 |
+
- **π Local Dictionary**: Built-in fallback for common Ibibio phrases
|
| 93 |
+
- **π― Smart Combining**: Merges all sources for best possible translation
|
| 94 |
+
|
| 95 |
+
## π Testing Queries
|
| 96 |
+
|
| 97 |
+
Try these example queries:
|
| 98 |
+
- "What is 'God is good' in Ibibio?"
|
| 99 |
+
- "How do you say 'thank you' in Ibibio?"
|
| 100 |
+
- "Translate 'good morning' to Ibibio"
|
| 101 |
+
- "What does 'sosongo' mean in English?"
|
| 102 |
+
|
| 103 |
+
## π― Next Steps
|
| 104 |
+
|
| 105 |
+
1. Deploy this backend to HF Spaces
|
| 106 |
+
2. Test the API endpoints
|
| 107 |
+
3. Integrate with your Ibi-Voice React frontend
|
| 108 |
+
4. Add more local dictionary entries as needed
|
| 109 |
+
|
| 110 |
---
|
| 111 |
|
| 112 |
+
**Built for JR Digital Insights** | Ibibio Language Preservation Project
|