Logo Lanfrica

Sampidia/Naija-Translator

Domain:

natural language processing

Record type:

software
Creator:
Sam
Host:
# Naija Translator (Implementation Scaffold) FastAPI scaffold implementing the planned API flows: - English Yoruba text translation (placeholder translator) - Yoruba speech -> English text translation (placeholder ASR + translator) - TTS generation with model-oriented providers: - `NCAIR1/NigerianAccentedEnglish` (English audio path) - `Workhelio/yoruba_tts` (Yoruba audio path) - Audio playback and download endpoints ## Run ```bash python -m venv .venv source .venv/bin/activate pip install -r requirements.txt uvicorn app.main:app --reload ``` ## Test ```bash pip install -r requirements.txt PYTHONPATH=. pytest -q ``` ## CI GitHub Actions runs compile checks and the full test suite on every push and pull request: - Workflow: `.github/workflows/ci.yml` - Steps: install dependencies, `python -m compileall app tests`, `PYTHONPATH=. pytest -q` ## Health endpoints - `GET /health/live` - `GET /health/ready` (returns 503 with failing `checks` when backend/model prerequisites are missing) ## Security controls - Optional API key auth via `REQUIRE_API_KEY=true` and `API_KEY`. - In-memory per-client rate limiting via `RATE_LIMIT_PER_MINUTE` (default 60). ## Do you need a FastAPI API key? - **For local development/testing:** No. Keep `REQUIRE_API_KEY=false`. - **For staging/production (recommended):** Yes. Set `REQUIRE_API_KEY=true` and a strong `API_KEY`, then send it as `x-api-key` on protected endpoints. - Health endpoints (`/health/live`, `/health/ready`) remain unauthenticated for platform probes. ## Job backend - Default in-process async workers. - Optional Redis-backed job status persistence with `USE_REDIS_JOBS=true` and `REDIS_URL`. ## Real model mode Set `USE_REAL_MODELS=true` to enable Hugging Face runtime model calls. Model IDs can be overridden with: - `EN_YO_MODEL_ID` - `YO_EN_MODEL_ID` - `YORUBA_ASR_MODEL_ID` - `NIGERIAN_ENGLISH_TTS_MODEL_ID` - `YORUBA_TTS_MODEL_ID` If disabled, providers use safe local fallbacks for development. When enabled, transl …