Spaces:
Running
Running
send
Browse files
README.md
CHANGED
|
@@ -1,114 +1,10 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
- **External Integration**: Connects to Milestone 1 Q&A service
|
| 12 |
-
|
| 13 |
-
## Quick Start
|
| 14 |
-
|
| 15 |
-
### Local Development
|
| 16 |
-
|
| 17 |
-
1. **Install Dependencies**
|
| 18 |
-
```bash
|
| 19 |
-
pip install -r requirements.txt
|
| 20 |
-
```
|
| 21 |
-
|
| 22 |
-
2. **Run the Server**
|
| 23 |
-
```bash
|
| 24 |
-
python main.py
|
| 25 |
-
```
|
| 26 |
-
|
| 27 |
-
3. **Test the API**
|
| 28 |
-
```bash
|
| 29 |
-
python test_simple.py
|
| 30 |
-
```
|
| 31 |
-
|
| 32 |
-
4. **Access Documentation**
|
| 33 |
-
- Interactive API docs: http://localhost:8000/docs
|
| 34 |
-
- Health check: http://localhost:8000/health
|
| 35 |
-
|
| 36 |
-
### Docker Deployment
|
| 37 |
-
|
| 38 |
-
1. **Build Image**
|
| 39 |
-
```bash
|
| 40 |
-
docker build -t farmlingua-api .
|
| 41 |
-
```
|
| 42 |
-
|
| 43 |
-
2. **Run Container**
|
| 44 |
-
```bash
|
| 45 |
-
docker run -p 8000:8000 farmlingua-api
|
| 46 |
-
```
|
| 47 |
-
|
| 48 |
-
## API Usage
|
| 49 |
-
|
| 50 |
-
### Single Endpoint: `/ask`
|
| 51 |
-
|
| 52 |
-
**POST** `/ask`
|
| 53 |
-
|
| 54 |
-
**Request Body:**
|
| 55 |
-
```json
|
| 56 |
-
{
|
| 57 |
-
"text": "Kedu ka m ga-esi na-akα»₯ α»ka?",
|
| 58 |
-
"lang": "ig"
|
| 59 |
-
}
|
| 60 |
-
```
|
| 61 |
-
|
| 62 |
-
**Response:**
|
| 63 |
-
```json
|
| 64 |
-
{
|
| 65 |
-
"language": "Igbo",
|
| 66 |
-
"language_code": "ig",
|
| 67 |
-
"original_text": "Kedu ka m ga-esi na-akα»₯ α»ka?",
|
| 68 |
-
"english_translation": "How can I plant grain?",
|
| 69 |
-
"response": "Jiri oghere mkpα»₯rα»₯ osisi ma α» bα»₯ osisi aka..."
|
| 70 |
-
}
|
| 71 |
-
```
|
| 72 |
-
|
| 73 |
-
### Supported Language Codes
|
| 74 |
-
|
| 75 |
-
| Code | Language | NLLB Code |
|
| 76 |
-
|------|----------|-----------|
|
| 77 |
-
| `en` | English | `eng_Latn` |
|
| 78 |
-
| `ig` | Igbo | `ibo_Latn` |
|
| 79 |
-
| `ha` | Hausa | `hau_Latn` |
|
| 80 |
-
| `yo` | Yoruba | `yor_Latn` |
|
| 81 |
-
| `sw` | Swahili | `swh_Latn` |
|
| 82 |
-
|
| 83 |
-
## Project Structure
|
| 84 |
-
|
| 85 |
-
```
|
| 86 |
-
FARMLINGUAMULTILINGUA/
|
| 87 |
-
βββ models/
|
| 88 |
-
β βββ model.py # Hugging Face translation model
|
| 89 |
-
βββ multilingual/
|
| 90 |
-
β βββ multi.py # FastAPI application
|
| 91 |
-
βββ main.py # Application entry point
|
| 92 |
-
βββ test_simple.py # Test suite
|
| 93 |
-
βββ requirements.txt # Python dependencies
|
| 94 |
-
βββ Dockerfile # Docker configuration
|
| 95 |
-
βββ .gitignore # Git ignore rules
|
| 96 |
-
βββ README.md # This file
|
| 97 |
-
```
|
| 98 |
-
|
| 99 |
-
## Environment Variables
|
| 100 |
-
|
| 101 |
-
- `HOST`: Server host (default: `0.0.0.0`)
|
| 102 |
-
- `PORT`: Server port (default: `8000`)
|
| 103 |
-
|
| 104 |
-
## Technology Stack
|
| 105 |
-
|
| 106 |
-
- **FastAPI**: Web framework
|
| 107 |
-
- **Transformers**: Hugging Face model pipeline
|
| 108 |
-
- **NLLB Model**: `drrobot9/nllb-ig-yo-ha-finetuned`
|
| 109 |
-
- **Uvicorn**: ASGI server
|
| 110 |
-
- **Docker**: Containerization
|
| 111 |
-
|
| 112 |
-
## License
|
| 113 |
-
|
| 114 |
-
MIT License
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: FARMLINGUAMULTILINGUA
|
| 3 |
+
emoji: π’
|
| 4 |
+
colorFrom: yellow
|
| 5 |
+
colorTo: pink
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|