Files
a2f-service/services/a2f_api/README.md
2025-12-24 15:15:13 +08:00

65 lines
949 B
Markdown

# Text to BlendShapes API
将文字转换为52个形态键的API服务
## 功能
1. 文字 → 音频 (使用 gTTS)
2. 音频 → CSV (使用 Audio2Face)
3. CSV → 52个形态键数据
## 安装
```bash
cd a2f_api
pip install -r requirements.txt
```
## 使用
```bash
python api.py
```
服务将在 `http://localhost:5001` 启动
## API 接口
### POST /text-to-blendshapes
**请求:**
```json
{
"text": "你好世界",
"language": "zh-CN"
}
```
**响应:**
```json
{
"success": true,
"frames": [
{
"timeCode": 0.0,
"blendShapes": {
"EyeBlinkLeft": 0.0,
"EyeLookDownLeft": 0.0,
...
"TongueOut": 0.0
}
}
],
"audio_path": "...",
"csv_path": "..."
}
```
## 文件说明
- `tts_service.py` - 文字转音频服务
- `a2f_service.py` - Audio2Face包装器
- `blend_shape_parser.py` - CSV解析器
- `text_to_blendshapes_service.py` - 主服务
- `api.py` - Flask API