JotunnBurton commited on
Commit
d6827bc
·
verified ·
1 Parent(s): 871a012

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -26
app.py CHANGED
@@ -161,32 +161,24 @@ def create_tts_fn(net_g_ms, hps):
161
  max_len = 100
162
  if len(text) > max_len:
163
  return "Error: Text is too long", None
164
- audio = (
165
- net_g_ms.infer(
166
- x_tst,
167
- x_tst_lengths,
168
- speakers,
169
- tones,
170
- lang_ids,
171
- bert,
172
- emo,
173
- sdp_ratio=sdp_ratio,
174
- noise_scale=noise_scale,
175
- noise_scale_w=noise_scale_w,
176
- length_scale=length_scale,
177
- )[0][0, 0]
178
- .data.cpu()
179
- .float()
180
- .numpy()
181
- )
182
- del (
183
- x_tst,
184
- tones,
185
- lang_ids,
186
- bert,
187
- x_tst_lengths,
188
- speakers,
189
- emo,
190
  )
191
  return "Success", (hps.data.sampling_rate, audio)
192
  return tts_fn
 
161
  max_len = 100
162
  if len(text) > max_len:
163
  return "Error: Text is too long", None
164
+ audio = infer(
165
+ text=text,
166
+ sdp_ratio=sdp_ratio,
167
+ noise_scale=noise_scale,
168
+ noise_scale_w=noise_scale_w,
169
+ length_scale=length_scale,
170
+ sid=sid,
171
+ language="JP", # หรือตามที่ user เลือก
172
+ hps=hps,
173
+ net_g=net_g_ms,
174
+ device=device,
175
+ emotion="neutral", # หรือตาม dropdown ที่ผู้ใช้เลือก
176
+ reference_audio=None,
177
+ skip_start=False,
178
+ skip_end=False,
179
+ style_text=None,
180
+ style_weight=0.7,
181
+ text_mode="Text"
 
 
 
 
 
 
 
 
182
  )
183
  return "Success", (hps.data.sampling_rate, audio)
184
  return tts_fn