luxtts速度很快在我的2080ti上短句秒出,需求显存也很低号称低至1G,效果也不错,但是它的Api调用方法我就不是很懂怎么用了,我黏贴一份它的API文档
Choose one of the following ways to interact with the API.
- Install the python client (docs) if you don't already have it installed.
copy
$ pip install gradio_client
Find the API endpoint below corresponding to your desired function in the app. Copy the code snippet, replacing the placeholder values with your own input data. Or use the
API Recorderto automatically generate your API requests.
API name: /infer Total requests: 11 (100% successful) | p50/p90/p99: 1.59 s / 1.71 s / 5.22 s
copy
from gradio_client import Client, handle_file
client = Client("http://127.0.0.1:7860/")
result = client.predict(
text="你好,这是一个语音克隆的示例效果。",
audio_prompt=handle_file('https://github.com/gradio-app/gradio/raw/main/test/test_files/audio_sample.wav'),
rms=0.01,
ref_duration=5,
t_shift=0.9,
num_steps=4,
speed=0.8,
return_smooth=False,
api_name="/infer"
)
print(result)Accepts 8 parameters:
text str Default: "你好,这是一个语音克隆的示例效果。"
The input value that is provided in the "待合成文本" Textbox component.
audio_prompt filepath Required
The input value that is provided in the "参考音频(WAV 格式)" Audio component. The FileData class is a subclass of the GradioModel class that represents a file object within a Gradio interface. It is used to store file data and metadata when a file is uploaded. Attributes: path: The server file path where the file is stored. url: The normalized server URL pointing to the file. size: The size of the file in bytes. orig_name: The original filename before upload. mime_type: The MIME type of the file. is_stream: Indicates whether the file is a stream. meta: Additional metadata used internally (should not be changed).
rms float Default: 0.01
The input value that is provided in the "RMS 音量(响度)" Number component.
ref_duration float Default: 5
The input value that is provided in the "参考音频时长(秒)" Number component.
t_shift float Default: 0.9
The input value that is provided in the "T-Shift(音色偏移)" Number component.
num_steps float Default: 4
The input value that is provided in the "采样步数(Steps)" Slider component.
speed float Default: 0.8
The input value that is provided in the "语速(越小越慢 / 越清晰)" Slider component.
return_smooth bool Default: False
The input value that is provided in the "启用平滑输出" Checkbox component.
Returns tuple of 2 elements
[0] filepath
The output value that appears in the "生成结果" Audio component.
[1] str
The output value that appears in the "value_21" Markdown component.