text-to-speech-maya
A small playground for the Maya text-to-speech inference handler and a FastAPI test server.
Run the FastAPI test server (local)
- Install dependencies. Follow the official PyTorch instructions for your platform first (CPU/MPS/CUDA), then install the remaining requirements:
# Example: install torch from https://pytorch.org/ for your system first, then:
pip install -r inference_endpoints/requirements.txt
- Start the server (set
MAYA_MODEL_PATHto your model path if needed):
export MAYA_MODEL_PATH="/path/to/maya_model"
uvicorn server.app:app --reload --host 0.0.0.0 --port 8000
- Test the synthesis endpoint (saves
output.wav):
curl -X POST "http://localhost:8000/synthesize" -H "Content-Type: application/json" -d '{
"description": "neutral female voice",
"text": "Hello world from Maya TTS"
}' --output output.wav
Notes
- The
EndpointHandlerexpects the Maya model to be compatible with the SNAC decoder flow; you may need to adapt token decoding depending on the actual model outputs. torchoften requires platform-specific wheels; ifpip install -rfails fortorch, install the appropriate wheel from pytorch.org first then re-run the requirements install for the remaining packages.
VSCode setup (recommended)
The repo includes helper files to make development in VSCode convenient: a workspace .venv, editor settings, tasks, and launch configurations.
- Create and activate a workspace venv (the Makefile has a helper):
make venv
source .venv/bin/activate
- Install project requirements into the venv:
pip install -r inference_endpoints/requirements.txt
# dev tools for formatting & linting
pip install black flake8
Open this folder in VSCode. The workspace settings point to
${workspaceFolder}/.venv/bin/pythonand the Python extension will activate the venv in the terminal.Useful VSCode features included:
- Formatting:
Blackis configured and will run on save (line length 88). - Linting:
flake8is enabled; run it using the Tasks panel or via the command palette. - Tasks: Run
Format: black,Lint: flake8, orRun server (run.sh)from the Tasks menu. - Launch: Use the
Run FastAPI (uvicorn)launch configuration to start the server with debugging enabled. It will loadserver/.envfor environment variables.
- Running the server from VSCode:
- Use the Run panel and choose
Run FastAPI (uvicorn)to start with the debugger. - Or open the integrated terminal, ensure the venv is active, and run:
./run.sh
- Poetry users
If you prefer Poetry for the server package, there's a server/pyproject.toml. From server/ run:
poetry install
poetry run uvicorn server.app:app --reload --host 0.0.0.0 --port 8000
If you want I can add a short checklist or developer guide in DEVELOPING.md with these steps and troubleshooting tips.
text-to-speech-maya
A small playground for the Maya text-to-speech inference handler and a FastAPI test server.
Run the FastAPI test server (local)
- Install dependencies. Follow the official PyTorch instructions for your platform first (CPU/MPS/CUDA), then install the remaining requirements:
# Example: install torch from https://pytorch.org/ for your system first, then:
pip install -r inference_endpoints/requirements.txt
- Start the server (set
MAYA_MODEL_PATHto your model path if needed):
export MAYA_MODEL_PATH="/path/to/maya_model"
uvicorn server.app:app --reload --host 0.0.0.0 --port 8000
- Test the synthesis endpoint (saves
output.wav):
curl -X POST "http://localhost:8000/synthesize" -H "Content-Type: application/json" -d '{
"description": "neutral female voice",
"text": "Hello world from Maya TTS"
}' --output output.wav
Notes
- The
EndpointHandlerexpects the Maya model to be compatible with the SNAC decoder flow; you may need to adapt token decoding depending on the actual model outputs. torchoften requires platform-specific wheels; ifpip install -rfails fortorch, install the appropriate wheel from pytorch.org first then re-run the requirements install for the remaining packages.