# Afan Oromo Voice Assistant
Small FastAPI + Streamlit starter for a conversational voice assistant:
1. User audio is uploaded or recorded in the browser.
2. The backend transcribes the audio.
3. The assistant generates a concise Afan Oromo response.
4. The backend returns response text in headers and a WAV audio stream.
The project runs in fallback mode by default, so it starts without downloading large models. Enable Hugging Face models with environment variables when the optional dependencies are installed.
## Install
```powershell
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
```
Optional Hugging Face support:
```powershell
pip install -r requirements-hf.txt
$env:ASSISTANT_USE_TRANSFORMERS = "1"
$env:ASSISTANT_STT_MODEL = "openai/whisper-small"
$env:ASSISTANT_LLM_MODEL = "HuggingFaceH4/zephyr-7b-beta"
$env:ASSISTANT_TTS_MODEL = "espnet/kan-bayashi/ljspeech_tts_train_raw_phn_tacotron2_g2p_en_no_space"
```
## Run
Start the API:
```powershell
uvicorn assistant:app --reload --host 0.0.0.0 --port 8000
```
Start the chat UI in another terminal:
```powershell
streamlit run assistant_app.py
```
Or use the helper script to run both together:
```powershell
python run_dev.py
```
Then open the Streamlit URL shown in the terminal.
## Development helper
The repository includes `run_dev.py` to launch the API and UI together. It starts `uvicorn` and `streamlit` in the same local workspace and terminates the server when Streamlit exits.
## Runtime Settings
The API defaults CORS access to the local Streamlit UI at `
localhost` and `
127.0.0.1`. Override it with a comma-separated list when needed:
```powershell
$env:ASSISTANT_CORS_ORIGINS = "
example.com,https"
```
Audio uploads are capped at 10 MB by default. Override the byte limit with:
```powershell
$env:ASSISTANT_MAX_AUDIO_BYTES = "10485760"
```
## Endpoints
- `GET /api/health` returns API and model status.
- `POST /api/ …