# Tradika by JintẽliaS
# 🚀 French ↔ Bassa Translation API
## 📌 Overview
This project provides a REST API powered by **FastAPI** for translating text between **French** and **Bassa** (a Bantu language spoken in Africa). The translation model is a custom-trained **MarianMT** model hosted on **Google Drive** and loaded dynamically at runtime.
It can be integrated into **Flutter mobile** and **web** apps via HTTP requests.
---
## 🧱 System Architecture
```
Flutter App (mobile/web)
↓
[ HTTP POST Request ]
↓
┌──────────────────────┐
│ FastAPI Server │
└──────────────────────┘
↓
[ Load MarianMT model ]
↓
[ Tokenizer + Inference ]
↓
[ JSON Response with Translation ]
```
---
## 📂 Project Structure
```
bassa_translate_api/
├── main.py # FastAPI backend
├── utils.py # Downloads model from Google Drive
├── requirements.txt # Python dependencies
├── start.sh # Render startup script
└── model/ # Directory for downloaded model
```
---
## ⚙️ Local Development Setup
```bash
git clone
github.com
cd bassa_translate_api
pip install -r requirements.txt
uvicorn main:app --reload
```
API available at: `
127.0.0.1`
---
## 🔁 API Endpoints
### `POST /translate`
**Description:** Translates text from French ↔ Bassa.
**Request (JSON):**
```json
{
"text": "Bonjour, comment vas-tu ?",
"direction": "Fr → Bs"
}
```
**Response (JSON):**
```json
{
"translation": "Mbɔtɔ, wa kɛ?"
}
```
**Valid `direction` values:**
* `"Fr → Bs"` (French to Bassa)
* `"Bs → Fr"` (Bassa to French)
---
## 📱 Flutter Integration (Mobile & Web)
### Add `http` package
```yaml
dependencies:
http: ^0.13.5
```
### Sample Code
```dart
import 'dart:convert';
import 'package:http/http.dart' as http;
Future translateText(String text, String direction) async {
final url = Uri.parse("
your-api-url.onrender.com");
final response = await http.post(
url,
headers: …