Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Update server.py , add API respose #1

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 95 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ A minimum inference engine for DiffSinger MIDI-less mode.

## Getting Started

1. Install `onnxruntime` following the [official guidance](https://onnxruntime.ai/).
1. Install `onnxruntime` following the [official guidance](https://onnxruntime.ai/). `pip install onnxruntime-gpu`
2. Install other dependencies with `pip install PyYAML soundfile`.
3. Download ONNX version of the NSF-HiFiGAN vocoder from [here](https://github.com/openvpi/vocoders/releases/tag/nsf-hifigan-v1) and unzip it into `assets/vocoder` directory.
4. Download an ONNX rhythm predictor from [here](https://github.com/openvpi/DiffSinger/releases/tag/v1.4.1) and put it into `assets/rhythmizer` directory.
Expand All @@ -12,10 +12,103 @@ A minimum inference engine for DiffSinger MIDI-less mode.
7. Run server with `python server.py` or `python server.py --config <YOUR_CONFIG>`.

## API Specification
* 版本信息

TBD
```
GET /version HTTP/1.1

HTTP/1.1 200 OK
{"version": "1.0.1", "date": "2023-01-08"}
```

* 模型列表
```
GET /models HTTP/1.1

HTTP/1.1 200 OK
Content-Type:application/json
{"models": ["1215_opencpop_ds1000_fix_label_nomidi"]}
```
* 生成节奏
```
POST /rhythm HTTP/1.1
Content-Type:application/json
{
"notes":[
{"key": 0,"duration": 0.5,"slur": false,"phonemes": ["SP"]},
{"key": 69,"duration": 0.5,"slur": false,"phonemes": ["sh","a"]},
{"key": 71,"duration": 1.0,"slur": true}
]
}

HTTP/1.1 200 OK
Content-Type:application/json
{"phonemes":[
{"name": "SP", "duration": 0.235995352268219},
{"name": "sh", "duration": 0.264004647731781},
{"name": "a", "duration": 1.5}
]}
```

* 提交
```
POST /submit HTTP/1.1
Content-Type:application/json
{
"model": "1215_opencpop_ds1000_fix_label_nomidi",
"phonemes":[
{"name": "SP", "duration": 0.235995352268219},
{"name": "sh", "duration": 0.264004647731781},
{"name": "a", "duration": 1.5}
],
"f0":{
"timestep": 0.01,
"values": [440.0,440.0,440.0,440.0,440.0]
},
"speedup": 50
}

HTTP/1.1 200 OK
Content-Type:application/json
{
"token": "afbc3057747f0cd98b67f01038855380",
"status": "SUBMITTED",
"code": "ae67"
}
```
* 查询
```
POST /query HTTP/1.1
Content-Type:application/json
{"token": "afbc3057747f0cd98b67f01038855380"}

HTTP/1.1 200 OK
Content-Type:application/json
{"status": "HIT_CACHE"}
```

* 取消任务
```
POST /cancel HTTP/1.1
Content-Type:application/json
{"token": "afbc3057747f0cd98b67f01038855380","code":"ae67"}
{"succeeded": false,"message": "Task result already in cache."}
```
* 下载文件
```
GET /download?token=afbc3057747f0cd98b67f01038855380 HTTP/1.1

HTTP/1.1 200 ok
content-type: audio/wav
```

## How to Obtain Acoustic Models

1. [Train with your own dataset](https://github.com/openvpi/DiffSinger/blob/refactor/pipelines/no_midi_preparation.ipynb) or download pretrained checkpoints from [here](https://github.com/openvpi/DiffSinger/releases/tag/v1.4.0).
2. Export PyTorch checkpoints to ONNX format. See instructions [here](https://github.com/openvpi/DiffSinger/blob/refactor/docs/README-SVS-onnx.md).

## 声明:
请确保你制作数据集的数据来源合法合规,且数据提供者明确你在制作什么以及可能造成的后果
该项目为歌声合成项目,无法进行其他用途,请知晓
本项目数据集来源:[Opencpop](https://wenet.org.cn/opencpop/liscense/)

5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
onnxruntime-gpu
PyYAML
soundfile
librosa
httpx
Loading