Spaces:
Runtime error
Runtime error
import gradio as gr | |
from gradio_client import Client | |
def greet(name, intensity): | |
print(name) | |
if intensity == 0: | |
client = Client("https://xzjosh-dz-bert-vits2-2-3.hf.space/--replicas/2f0jm/") | |
result = client.predict( | |
name, | |
# str in '输入文本内容' Textbox component | |
"丁真", # str (Option from: [('丁真', '丁真')]) in 'Speaker' Dropdown component | |
0.5, # int | float (numeric value between 0 and 1) in 'SDP Ratio' Slider component | |
0.5, # int | float (numeric value between 0.1 and 2) in 'Noise' Slider component | |
0.9, # int | float (numeric value between 0.1 and 2) in 'Noise_W' Slider component | |
1, # int | float (numeric value between 0.1 and 2) in 'Length' Slider component | |
"auto", | |
"1.wav", | |
"Howdy!", # str in 'Text prompt' Textbox component | |
"Text prompt", # str in 'Prompt Mode' Radio component | |
"Howdy!", # str in '辅助文本' Textbox component | |
0, # int | float (numeric value between 0 and 1) in 'Weight' Slider component | |
fn_index=0 | |
) | |
print(result) | |
return result[1] | |
if intensity == 1: | |
client = Client("https://xzjosh-sun-bert-vits2.hf.space/--replicas/hclz8/") | |
result = client.predict( | |
name, # str in '输入文本内容' Textbox component | |
"孙笑川", # str (Option from: [('孙笑川', '孙笑川')]) in 'Speaker' Dropdown component | |
0.5, # int | float (numeric value between 0 and 1) in 'SDP Ratio' Slider component | |
0.5, # int | float (numeric value between 0.1 and 2) in 'Noise' Slider component | |
0.9, # int | float (numeric value between 0.1 and 2) in 'Noise_W' Slider component | |
1, # int | float (numeric value between 0.1 and 2) in 'Length' Slider component | |
"auto", | |
"1.wav", | |
"Howdy!", # str in 'Text prompt' Textbox component | |
"Text prompt", # str in 'Prompt Mode' Radio component | |
fn_index=0 | |
) | |
print(result) | |
return result[1] | |
demo = gr.Interface( | |
fn=greet, | |
inputs=["text", "slider"], | |
outputs=["text"], | |
) | |
demo.launch(share=True) | |