mrq commited on
Commit
fe03ae5
·
1 Parent(s): 9d2c7fb
Files changed (2) hide show
  1. src/utils.py +7 -0
  2. src/webui.py +11 -1
src/utils.py CHANGED
@@ -49,6 +49,7 @@ WHISPER_BACKENDS = ["openai/whisper", "lightmare/whispercpp"]
49
  VOCODERS = ['univnet', 'bigvgan_base_24khz_100band', 'bigvgan_24khz_100band']
50
  TTSES = ['tortoise']
51
 
 
52
  GENERATE_SETTINGS_ARGS = None
53
 
54
  LEARNING_RATE_SCHEMES = {"Multistep": "MultiStepLR", "Cos. Annealing": "CosineAnnealingLR_Restart"}
@@ -320,6 +321,7 @@ def generate(**kwargs):
320
 
321
  return info
322
 
 
323
  for line, cut_text in enumerate(texts):
324
  if parameters['emotion'] == "Custom":
325
  if parameters['prompt'] and parameters['prompt'].strip() != "":
@@ -371,6 +373,7 @@ def generate(**kwargs):
371
 
372
  del gen
373
  do_gc()
 
374
 
375
  for k in audio_cache:
376
  audio = audio_cache[k]['audio']
@@ -486,7 +489,11 @@ def generate(**kwargs):
486
  )
487
 
488
  def cancel_generate():
 
 
 
489
  import tortoise.api
 
490
  tortoise.api.STOP_SIGNAL = True
491
 
492
  def hash_file(path, algo="md5", buffer_size=0):
 
49
  VOCODERS = ['univnet', 'bigvgan_base_24khz_100band', 'bigvgan_24khz_100band']
50
  TTSES = ['tortoise']
51
 
52
+ INFERENCING = False
53
  GENERATE_SETTINGS_ARGS = None
54
 
55
  LEARNING_RATE_SCHEMES = {"Multistep": "MultiStepLR", "Cos. Annealing": "CosineAnnealingLR_Restart"}
 
321
 
322
  return info
323
 
324
+ INFERENCING = True
325
  for line, cut_text in enumerate(texts):
326
  if parameters['emotion'] == "Custom":
327
  if parameters['prompt'] and parameters['prompt'].strip() != "":
 
373
 
374
  del gen
375
  do_gc()
376
+ INFERENCING = False
377
 
378
  for k in audio_cache:
379
  audio = audio_cache[k]['audio']
 
489
  )
490
 
491
  def cancel_generate():
492
+ if not INFERENCING:
493
+ return
494
+
495
  import tortoise.api
496
+
497
  tortoise.api.STOP_SIGNAL = True
498
 
499
  def hash_file(path, algo="md5", buffer_size=0):
src/webui.py CHANGED
@@ -155,6 +155,16 @@ def import_generate_settings_proxy( file=None ):
155
 
156
  return tuple(res)
157
 
 
 
 
 
 
 
 
 
 
 
158
  def compute_latents_proxy(voice, voice_latents_chunks, progress=gr.Progress(track_tqdm=True)):
159
  compute_latents( voice=voice, voice_latents_chunks=voice_latents_chunks, progress=progress )
160
  return voice
@@ -688,7 +698,7 @@ def setup_gradio():
688
  )
689
 
690
  reset_generation_settings_button.click(
691
- fn=reset_generation_settings,
692
  inputs=None,
693
  outputs=generate_settings
694
  )
 
155
 
156
  return tuple(res)
157
 
158
+ def reset_generate_settings_proxy( file=None ):
159
+ global GENERATE_SETTINGS_ARGS
160
+ settings = reset_generate_settings( file )
161
+
162
+ res = []
163
+ for k in GENERATE_SETTINGS_ARGS:
164
+ res.append(settings[k] if k in settings else None)
165
+
166
+ return tuple(res)
167
+
168
  def compute_latents_proxy(voice, voice_latents_chunks, progress=gr.Progress(track_tqdm=True)):
169
  compute_latents( voice=voice, voice_latents_chunks=voice_latents_chunks, progress=progress )
170
  return voice
 
698
  )
699
 
700
  reset_generation_settings_button.click(
701
+ fn=reset_generation_settings_proxy,
702
  inputs=None,
703
  outputs=generate_settings
704
  )