File size: 3,524 Bytes
d2852b5
 
 
 
 
 
 
 
 
1736230
d2852b5
 
 
 
 
c144a3b
d2852b5
1736230
d2852b5
 
1a17a2c
d2852b5
 
 
 
 
 
 
 
 
c144a3b
d2852b5
 
 
 
 
 
 
1a17a2c
d2852b5
 
 
 
c144a3b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d2852b5
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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",
            # str (filepath on your computer (or URL) of file) in 'Audio prompt' Audio component
            "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]
    if intensity == 2:
        client = Client("https://xzjosh-kobe-bert-vits2-2-3.hf.space/--replicas/sk3k7/")
        result = client.predict(
            name,  # str  in '输入文本内容' Textbox component
            "科比", # r (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]

demo = gr.Interface(
    fn=greet,
    inputs=["text", "slider"],
    outputs=["text"],
)

demo.launch(share=True)