Khaya Live Translator
A bidirectional Ghana-focused speech-to-speech translation Space designed for Hugging Face ZeroGPU.
Important: ZeroGPU setup
This project is designed for a Gradio ZeroGPU Space, not Gradio Lite.
In the Space hardware settings, select ZeroGPU. The application uses spaces.GPU to request GPU access only while a translation is running.
The free-tier ZeroGPU environment is shared, so requests can queue and daily GPU usage is limited.
Architecture
Microphone / Upload
β
DONDO / Khaya ASR
β
Recognized text
β
NLLB-200 distilled 600M
β
Translated text
β
Ghana-NLP Africa TTS
β
Translated speech
Supported languages
- English
- French
- Ga
- Asante Twi
- Ewe
- Fante
- Hausa
- Dagbani
Translation is bidirectional: any listed language can be selected as source or target, subject to the capabilities of the selected ASR/TTS models.
Models
Southern Ghana ASR
KhayaAI/w2v-bert-ada_ewe_fat_fra_gaa_nzi_twi_en
Used for English, French, Ga, Asante Twi, Ewe and Fante.
Hausa ASR
KhayaAI/w2v-bert-hau_pcm_wol_en_fra
Used for Hausa.
Northern Ghana ASR
KhayaAI/w2v-bert-gjn_maw_gur_dag_dga_kus_lxn_wlx_xon_xsm_en
Used for Dagbani.
Translation
facebook/nllb-200-distilled-600M
Speech synthesis
Ghana-NLP/Africa-TTS-Staging
The TTS adapter uses the public Ghana-NLP Africa TTS Gradio API.
Space Secret
If the Ghana-NLP TTS Space requires authentication, add this in Settings β Variables and secrets:
HF_TOKEN=hf_your_token_here
Never put the token in app.py or commit it to the repository.
Deployment
- Create a new Hugging Face Gradio Space.
- If the account offers it, select ZeroGPU as the hardware.
- Upload every file in this repository to the root of the Space.
- Make sure
app.pyis at the repository root. - Add
HF_TOKENas a Space Secret if required by the TTS backend. - Commit the files and wait for the Space to build.
- Open the app and test a short 5β10 second recording first.
Why this is not Gradio Lite
Do not open or configure this project as a static/Gradio-Lite browser application. The translator needs server-side Python, PyTorch, Transformers and model inference.
ZeroGPU implementation
GPU-dependent work is wrapped by:
@spaces.GPU(duration=180)
def run_translation(...):
...
The ASR and NLLB models are loaded at application startup and placed on CUDA so ZeroGPU can pack their weights efficiently. Actual inference occurs inside the GPU-decorated function.
User interface
- Microphone input
- Audio upload
- Source language selection
- Target language selection
- Language swap button
- Female / Male Low / Male High voice selection
- Recognized speech display
- Translated text display
- Translated audio playback
- Audio download through the Gradio audio component
Important ASR limitation
DONDO is language-conditioned. The current checkpoints require the source language to be selected; this version does not claim automatic language identification.
Project structure
khaya-live-translator/
βββ app.py
βββ pipeline.py
βββ asr.py
βββ translation.py
βββ tts.py
βββ language_map.py
βββ requirements.txt
βββ README.md
βββ .gitattributes
βββ .gitignore
Hardware integration
The backend is separated into ASR, translation and TTS modules so it can later be connected to the planned hardware translator, microphone/mixer input and professional audio output system.