Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -36,13 +36,17 @@ def load_set(set_file):
|
|
| 36 |
gr.update(value=set_json['noise']),gr.update(value=set_json['width']),
|
| 37 |
gr.update(value=set_json['pause']))
|
| 38 |
txt="""PiperTTS is a powerful text-to-speech TTS node designed to convert written text into high-quality spoken audio. This node leverages advanced voice synthesis models to generate natural-sounding speech, making it an invaluable tool for AI developers looking to add a vocal element to their projects."""
|
| 39 |
-
def exp1(
|
| 40 |
-
exp_file=f"./example/en_US-
|
| 41 |
return(gr.update(value=txt),gr.update(value=exp_file))
|
| 42 |
-
def exp2(
|
| 43 |
exp_file=f"./example/en_US-ryan-high__1__0_6__0_01__1.json"
|
| 44 |
return(gr.update(value=txt),gr.update(value=exp_file))
|
|
|
|
|
|
|
|
|
|
| 45 |
|
|
|
|
| 46 |
with gr.Blocks(theme="Hev832/Applio-Theme") as b:
|
| 47 |
gr.HTML("""<h1 style='font-size:xxx-large;font-weight:900;'>Piper Fast TTS</h1>
|
| 48 |
<h4>Piper: <a href='https://github.com/rhasspy/piper' target='_blank'>https://github.com/rhasspy/piper</a></h4>
|
|
@@ -66,14 +70,13 @@ with gr.Blocks(theme="Hev832/Applio-Theme") as b:
|
|
| 66 |
sub_btn=gr.Button()
|
| 67 |
out_aud=gr.Audio(streaming=True, autoplay=True)
|
| 68 |
with gr.Column(scale=1):
|
| 69 |
-
expbtn1=gr.Button("Example 1")
|
| 70 |
-
expbtn2=gr.Button("Example 2")
|
|
|
|
| 71 |
with gr.Accordion("Model Config"):
|
| 72 |
json_ob=gr.JSON(label="JSON")
|
| 73 |
save_btn.click(save_set,[names,length,noise,width,sen_pause],save_file)
|
| 74 |
load_file.change(load_set,load_file,[names,length,noise,width,sen_pause])
|
| 75 |
-
expbtn1.click(exp1,None,[in_txt,load_file])
|
| 76 |
-
expbtn2.click(exp2,None,[in_txt,load_file])
|
| 77 |
names.change(load_mod,names,json_ob)
|
| 78 |
sub_btn.click(pp.tts,[in_txt,names,length,noise,width,sen_pause],out_aud)
|
| 79 |
b.load(init,None,names)
|
|
|
|
| 36 |
gr.update(value=set_json['noise']),gr.update(value=set_json['width']),
|
| 37 |
gr.update(value=set_json['pause']))
|
| 38 |
txt="""PiperTTS is a powerful text-to-speech TTS node designed to convert written text into high-quality spoken audio. This node leverages advanced voice synthesis models to generate natural-sounding speech, making it an invaluable tool for AI developers looking to add a vocal element to their projects."""
|
| 39 |
+
def exp1():
|
| 40 |
+
exp_file=f"./example/en_US-libritts-high__1_4__0_3__0_2__1.json"
|
| 41 |
return(gr.update(value=txt),gr.update(value=exp_file))
|
| 42 |
+
def exp2():
|
| 43 |
exp_file=f"./example/en_US-ryan-high__1__0_6__0_01__1.json"
|
| 44 |
return(gr.update(value=txt),gr.update(value=exp_file))
|
| 45 |
+
def exp3():
|
| 46 |
+
exp_file=f"./example/en_US-ljspeech-high__1__1__0_5__1.json"
|
| 47 |
+
return(gr.update(value=txt),gr.update(value=exp_file))
|
| 48 |
|
| 49 |
+
|
| 50 |
with gr.Blocks(theme="Hev832/Applio-Theme") as b:
|
| 51 |
gr.HTML("""<h1 style='font-size:xxx-large;font-weight:900;'>Piper Fast TTS</h1>
|
| 52 |
<h4>Piper: <a href='https://github.com/rhasspy/piper' target='_blank'>https://github.com/rhasspy/piper</a></h4>
|
|
|
|
| 70 |
sub_btn=gr.Button()
|
| 71 |
out_aud=gr.Audio(streaming=True, autoplay=True)
|
| 72 |
with gr.Column(scale=1):
|
| 73 |
+
expbtn1=gr.Button("Example 1").click(exp1,None,[in_txt,load_file])
|
| 74 |
+
expbtn2=gr.Button("Example 2").click(exp2,None,[in_txt,load_file])
|
| 75 |
+
expbtn3=gr.Button("Example 3").click(exp3,None,[in_txt,load_file])
|
| 76 |
with gr.Accordion("Model Config"):
|
| 77 |
json_ob=gr.JSON(label="JSON")
|
| 78 |
save_btn.click(save_set,[names,length,noise,width,sen_pause],save_file)
|
| 79 |
load_file.change(load_set,load_file,[names,length,noise,width,sen_pause])
|
|
|
|
|
|
|
| 80 |
names.change(load_mod,names,json_ob)
|
| 81 |
sub_btn.click(pp.tts,[in_txt,names,length,noise,width,sen_pause],out_aud)
|
| 82 |
b.load(init,None,names)
|