Update app.py
Browse files
app.py
CHANGED
|
@@ -35,13 +35,14 @@ def load_mod(instr="lb_LU-marylux-medium"):
|
|
| 35 |
# file.write(json.dumps(set_json,indent=4))
|
| 36 |
# file.close()
|
| 37 |
# return(f'{os.getcwd()}/saved/{file_name}.json')
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
|
|
|
| 45 |
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."""
|
| 46 |
# def exp1():
|
| 47 |
# exp_file=f"./example/en_US-libritts-high__1_4__0_3__0_2__1.json"
|
|
@@ -91,14 +92,14 @@ with gr.Blocks() as b:
|
|
| 91 |
# json_ob=gr.JSON(label="JSON")
|
| 92 |
f1=stream.change(button_on,stream,[stream_btn,sub_btn])
|
| 93 |
# f2=save_btn.click(save_set,[names,length,noise,width,sen_pause],save_file)
|
| 94 |
-
|
| 95 |
# f4=names.change(load_mod,names,json_ob).then(clear_aud,None,out_aud)
|
| 96 |
f5=stream_btn.click(clear_aud,None,out_aud)
|
| 97 |
f6=stream_btn.click(pp.stream_tts,[in_txt,names,length,noise,width,sen_pause],out_aud)
|
| 98 |
f7=sub_btn.click(clear_aud,None,out_aud)
|
| 99 |
f8=sub_btn.click(pp.tts,[in_txt,names,length,noise,width,sen_pause],out_aud)
|
| 100 |
# cancel_btn.click(None,None,None,cancels=[f1,f2,f3,f4,f5,f6,f7,f8])
|
| 101 |
-
cancel_btn.click(None,None,None,cancels=[f1,f5,f6,f7,f8])
|
| 102 |
b.load(init,None,names)
|
| 103 |
|
| 104 |
b.queue(default_concurrency_limit=20).launch(max_threads=40)
|
|
|
|
| 35 |
# file.write(json.dumps(set_json,indent=4))
|
| 36 |
# file.close()
|
| 37 |
# return(f'{os.getcwd()}/saved/{file_name}.json')
|
| 38 |
+
|
| 39 |
+
def load_set(set_file):
|
| 40 |
+
with open(set_file,'r') as file:
|
| 41 |
+
set_json=json.loads(file.read())
|
| 42 |
+
file.close()
|
| 43 |
+
return(gr.update(value=set_json['model']),gr.update(value=set_json['length']),
|
| 44 |
+
gr.update(value=set_json['noise']),gr.update(value=set_json['width']),
|
| 45 |
+
gr.update(value=set_json['pause']))
|
| 46 |
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."""
|
| 47 |
# def exp1():
|
| 48 |
# exp_file=f"./example/en_US-libritts-high__1_4__0_3__0_2__1.json"
|
|
|
|
| 92 |
# json_ob=gr.JSON(label="JSON")
|
| 93 |
f1=stream.change(button_on,stream,[stream_btn,sub_btn])
|
| 94 |
# f2=save_btn.click(save_set,[names,length,noise,width,sen_pause],save_file)
|
| 95 |
+
f3=load_file.change(load_set,load_file,[names,length,noise,width,sen_pause])
|
| 96 |
# f4=names.change(load_mod,names,json_ob).then(clear_aud,None,out_aud)
|
| 97 |
f5=stream_btn.click(clear_aud,None,out_aud)
|
| 98 |
f6=stream_btn.click(pp.stream_tts,[in_txt,names,length,noise,width,sen_pause],out_aud)
|
| 99 |
f7=sub_btn.click(clear_aud,None,out_aud)
|
| 100 |
f8=sub_btn.click(pp.tts,[in_txt,names,length,noise,width,sen_pause],out_aud)
|
| 101 |
# cancel_btn.click(None,None,None,cancels=[f1,f2,f3,f4,f5,f6,f7,f8])
|
| 102 |
+
cancel_btn.click(None,None,None,cancels=[f1,f3,f5,f6,f7,f8])
|
| 103 |
b.load(init,None,names)
|
| 104 |
|
| 105 |
b.queue(default_concurrency_limit=20).launch(max_threads=40)
|