Baseta commited on
Commit
33418de
1 Parent(s): e1fb01a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -500,6 +500,10 @@ def change_choices():
500
 
501
 
502
  def clean():
 
 
 
 
503
  return {"value": "", "__type__": "update"}
504
 
505
 
@@ -1535,7 +1539,6 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="red", secondary_hue="rose"),
1535
  record_button.change(fn=save_to_wav, inputs=[record_button], outputs=[input_audio0])
1536
  record_button.change(fn=change_choices2, inputs=[], outputs=[input_audio0])
1537
  with gr.Row():
1538
- clean_button = gr.Button("Clean", variant="secondary", size='sm')
1539
  with gr.Accordion('Google TTS', open=False, visible=True):
1540
  with gr.Column():
1541
  lang = gr.Radio(label='Chinese & Japanese do not work with ElevenLabs currently.',choices=['ar','en','it','es','fr','pt','zh-CN','de','hi','ja'], value='ar')
@@ -1545,6 +1548,8 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="red", secondary_hue="rose"),
1545
  tfs = gr.Textbox(label="Input your Text", interactive=True, value="This is a test.")
1546
  tts_button = gr.Button(value="Speak")
1547
  tts_button.click(fn=elevenTTS, inputs=[api_box,tfs, elevenid, lang], outputs=[record_button, input_audio0])
 
 
1548
  clean_button.click(fn=clean, inputs=[], outputs=[sid0])
1549
  with gr.Row():
1550
  with gr.Accordion('Wav2Lip', open=False, visible=False):
 
500
 
501
 
502
  def clean():
503
+ if hubert_model != None: # 考虑到轮询, 需要加个判断看是否 sid 是由有模型切换到无模型的
504
+ print("clean_empty_cache")
505
+ del net_g, n_spk, vc, hubert_model, tgt_sr # ,cpt
506
+ hubert_model = net_g = n_spk = vc = hubert_model = tgt_sr = None
507
  return {"value": "", "__type__": "update"}
508
 
509
 
 
1539
  record_button.change(fn=save_to_wav, inputs=[record_button], outputs=[input_audio0])
1540
  record_button.change(fn=change_choices2, inputs=[], outputs=[input_audio0])
1541
  with gr.Row():
 
1542
  with gr.Accordion('Google TTS', open=False, visible=True):
1543
  with gr.Column():
1544
  lang = gr.Radio(label='Chinese & Japanese do not work with ElevenLabs currently.',choices=['ar','en','it','es','fr','pt','zh-CN','de','hi','ja'], value='ar')
 
1548
  tfs = gr.Textbox(label="Input your Text", interactive=True, value="This is a test.")
1549
  tts_button = gr.Button(value="Speak")
1550
  tts_button.click(fn=elevenTTS, inputs=[api_box,tfs, elevenid, lang], outputs=[record_button, input_audio0])
1551
+ with gr.Row():
1552
+ clean_button = gr.Button("Clean", variant="secondary", size='sm')
1553
  clean_button.click(fn=clean, inputs=[], outputs=[sid0])
1554
  with gr.Row():
1555
  with gr.Accordion('Wav2Lip', open=False, visible=False):