这是一个基于 PaddleSpeech 的语音识别 API 服务,使用 FastAPI 构建。
- 支持 WAV 格式的音频文件识别
- 使用 PaddleSpeech 的 deepspeech2online_wenetspeech 模型
- 提供 RESTful API 接口
- 安装依赖:
pip install -r requirements.txt
- 启动服务:
python -m uvicorn app:app --reload --host 0.0.0.0 --port 8011
uvicorn app:app --host 0.0.0.0 --port 8011
- 构建镜像:
docker build -t speech-recognition-api .
- 运行容器:
docker run -p 8011:8011 speech-recognition-api
curl -X POST "http://localhost:8011/recognize" \
-H "accept: application/json" \
-H "Content-Type: multipart/form-data" \
-F "audio=@your_audio.wav"
curl "http://localhost:8011/health"
Docker 镜像可以从 GitHub Container Registry 获取:
docker pull ghcr.io/your-username/speech-recognition-api:latest
- 克隆仓库:
git clone https://github.com/your-username/speech-recognition-api.git
cd speech-recognition-api
- 安装开发依赖:
pip install -r requirements.txt
- 运行测试:
pytest
语音相关服务,通过fastapi进行封装