# 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: β¦