m4jbz commited on
Commit
6002d90
1 Parent(s): 7320afc
Files changed (1) hide show
  1. app.py +4 -48
app.py CHANGED
@@ -56,18 +56,6 @@ css = """
56
  """
57
 
58
 
59
- def update_model_dropdown(language: str):
60
- if language in language_to_models:
61
- choices = language_to_models[language]
62
- return gr.Dropdown(
63
- choices=choices,
64
- value=choices[0],
65
- interactive=True,
66
- )
67
-
68
- raise ValueError(f"Unsupported language: {language}")
69
-
70
-
71
  def build_html_output(s: str, style: str = "result_item_success"):
72
  return f"""
73
  <div class='result'>
@@ -78,13 +66,12 @@ def build_html_output(s: str, style: str = "result_item_success"):
78
  """
79
 
80
 
81
- def process(language: str, repo_id: str, text: str, sid: str, speed: float):
82
- logging.info(f"Input text: {text}. sid: {sid}, speed: {speed}")
83
- sid = int(sid)
84
  tts = get_pretrained_model(repo_id, speed)
85
 
86
  start = time.time()
87
- audio = tts.generate(text, sid=sid)
88
  end = time.time()
89
 
90
  if len(audio.samples) == 0:
@@ -104,7 +91,7 @@ def process(language: str, repo_id: str, text: str, sid: str, speed: float):
104
  """
105
 
106
  logging.info(info)
107
- logging.info(f"\nrepo_id: {repo_id}\ntext: {text}\nsid: {sid}\nspeed: {speed}")
108
 
109
  filename = str(uuid.uuid4())
110
  filename = f"{filename}.wav"
@@ -123,25 +110,6 @@ demo = gr.Blocks(css=css)
123
 
124
  with demo:
125
  gr.Markdown(title)
126
- language_choices = list(language_to_models.keys())
127
-
128
- language_radio = gr.Radio(
129
- label="Idioma",
130
- choices=language_choices,
131
- value=language_choices[0],
132
- )
133
-
134
- model_dropdown = gr.Dropdown(
135
- choices=language_to_models[language_choices[0]],
136
- label="Seleccion un modelo",
137
- value=language_to_models[language_choices[0]][0],
138
- )
139
-
140
- language_radio.change(
141
- update_model_dropdown,
142
- inputs=language_radio,
143
- outputs=model_dropdown,
144
- )
145
 
146
  with gr.Tabs():
147
  with gr.TabItem("Por favor ingresa tu texto"):
@@ -152,15 +120,6 @@ with demo:
152
  placeholder="Por favor ingresa tu texto aquí",
153
  )
154
 
155
- input_sid = gr.Textbox(
156
- label="Speaker ID",
157
- info="Speaker ID",
158
- lines=1,
159
- max_lines=1,
160
- value="0",
161
- placeholder="Speaker ID. Valid only for mult-speaker model",
162
- )
163
-
164
  input_speed = gr.Slider(
165
  minimum=0.1,
166
  maximum=10,
@@ -178,10 +137,7 @@ with demo:
178
  input_button.click(
179
  process,
180
  inputs=[
181
- language_radio,
182
- model_dropdown,
183
  input_text,
184
- input_sid,
185
  input_speed,
186
  ],
187
  outputs=[
 
56
  """
57
 
58
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  def build_html_output(s: str, style: str = "result_item_success"):
60
  return f"""
61
  <div class='result'>
 
66
  """
67
 
68
 
69
+ def process(language: str, repo_id: str, text: str, speed: float):
70
+ logging.info(f"Input text: {text}. Speed: {speed}")
 
71
  tts = get_pretrained_model(repo_id, speed)
72
 
73
  start = time.time()
74
+ audio = tts.generate(text)
75
  end = time.time()
76
 
77
  if len(audio.samples) == 0:
 
91
  """
92
 
93
  logging.info(info)
94
+ logging.info(f"\nrepo_id: {repo_id}\ntext: {text}\nspeed: {speed}")
95
 
96
  filename = str(uuid.uuid4())
97
  filename = f"{filename}.wav"
 
110
 
111
  with demo:
112
  gr.Markdown(title)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
 
114
  with gr.Tabs():
115
  with gr.TabItem("Por favor ingresa tu texto"):
 
120
  placeholder="Por favor ingresa tu texto aquí",
121
  )
122
 
 
 
 
 
 
 
 
 
 
123
  input_speed = gr.Slider(
124
  minimum=0.1,
125
  maximum=10,
 
137
  input_button.click(
138
  process,
139
  inputs=[
 
 
140
  input_text,
 
141
  input_speed,
142
  ],
143
  outputs=[