Add start-gpu.sh script for GPU-enabled FastAPI deployment

- Create GPU-specific startup script
- Set environment variables for GPU and project configuration
- Use uv to install GPU extras and run FastAPI server
This commit is contained in:
CodePothunter 2025-03-07 20:24:07 +08:00
parent 6e79b252d0
commit 70c0d506de

16
start-gpu.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/bash
# Get project root directory
PROJECT_ROOT=$(pwd)
# Set environment variables
export USE_GPU=true
export USE_ONNX=false
export PYTHONPATH=$PROJECT_ROOT:$PROJECT_ROOT/api
export MODEL_DIR=src/models
export VOICES_DIR=src/voices/v1_0
export WEB_PLAYER_PATH=$PROJECT_ROOT/web
# Run FastAPI with GPU extras using uv run
uv pip install -e ".[gpu]"
uv run --no-sync uvicorn api.src.main:app --host 0.0.0.0 --port 50888