ibi-voice-backend / README.md
Josebert's picture
Update README.md
92ca42f verified

A newer version of the Gradio SDK is available: 6.2.0

Upgrade
metadata
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
  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
  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

// 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

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