AlexK-PL commited on
Commit
e538d1b
1 Parent(s): 42c2a9e

Update infer_onnx.py

Browse files
Files changed (1) hide show
  1. infer_onnx.py +7 -0
infer_onnx.py CHANGED
@@ -15,6 +15,7 @@ import random
15
 
16
  from AinaTheme import theme
17
 
 
18
  DEFAULT_SPEAKER_ID = os.environ.get("DEFAULT_SPEAKER_ID", default="quim")
19
  DEFAULT_ACCENT= os.environ.get("DEFAULT_ACCENT", default="balear")
20
 
@@ -184,6 +185,12 @@ def tts(text:str, accent:str, spk_name:str, temperature:float, length_scale:floa
184
  print(f"RTF matcha + vocos { (mel_infer_secs + vocos_infer_secs) / (wavs_vocos.shape[1]/22050) }")
185
  return fp_matcha_vocos.name
186
 
 
 
 
 
 
 
187
  ## GUI space
188
 
189
  title = """
 
15
 
16
  from AinaTheme import theme
17
 
18
+ MAX_INPUT_CHARACTERS = int(os.environ.get("MAX_INPUT_CHARACTERS", default=500))
19
  DEFAULT_SPEAKER_ID = os.environ.get("DEFAULT_SPEAKER_ID", default="quim")
20
  DEFAULT_ACCENT= os.environ.get("DEFAULT_ACCENT", default="balear")
21
 
 
185
  print(f"RTF matcha + vocos { (mel_infer_secs + vocos_infer_secs) / (wavs_vocos.shape[1]/22050) }")
186
  return fp_matcha_vocos.name
187
 
188
+
189
+ def change_interactive(text):
190
+ if len(text.strip()) > MAX_INPUT_CHARACTERS:
191
+ return gr.update(interactive = True), gr.update(interactive = False)
192
+ return gr.update(interactive = True), gr.update(interactive = True)
193
+
194
  ## GUI space
195
 
196
  title = """