cymic commited on
Commit
6aabdc9
1 Parent(s): 8d906ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -238,6 +238,14 @@ download_audio_js = """
238
  }}
239
  """
240
 
 
 
 
 
 
 
 
 
241
  if __name__ == "__main__":
242
  parser = argparse.ArgumentParser()
243
  parser.add_argument("--share", action="store_true", default=False, help="share gradio app")
@@ -325,10 +333,13 @@ if __name__ == "__main__":
325
  "您可以手动修改这些数字来控制每个音素以及间隔的长度,从而完全控制合成音频的说话节奏。"
326
  "注意这些数字只能是整数。 \n\n(1 代表 0.01161 秒的长度)\n\n"
327
  )
 
 
 
328
  btn.click(infer, inputs=[textbox, char_dropdown, language_dropdown, duration_slider, noise_scale_slider, noise_scale_w_slider, symbol_input],
329
- outputs=[text_output, audio_output, phoneme_output, duration_output])
330
  cus_dur_gn_btn.click(infer_from_phoneme_dur, inputs=[duration_output, char_dropdown, duration_slider, noise_scale_slider, noise_scale_w_slider],
331
- outputs=[phoneme_output, audio_output])
332
 
333
  examples = [['haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......', '29:米浴', '日本語', 1, 0.667, 0.8, True],
334
  ['お疲れ様です,トレーナーさん。', '1:无声铃鹿', '日本語', 1, 0.667, 0.8, False],
 
238
  }}
239
  """
240
 
241
+ def monkey_patch():
242
+ def postprocess(self, y):
243
+ """
244
+ Any postprocessing needed to be performed on a block context.
245
+ """
246
+ return y
247
+ gr.blocks.BlockContext.postprocess = postprocess
248
+
249
  if __name__ == "__main__":
250
  parser = argparse.ArgumentParser()
251
  parser.add_argument("--share", action="store_true", default=False, help="share gradio app")
 
333
  "您可以手动修改这些数字来控制每个音素以及间隔的长度,从而完全控制合成音频的说话节奏。"
334
  "注意这些数字只能是整数。 \n\n(1 代表 0.01161 秒的长度)\n\n"
335
  )
336
+
337
+ monkey_patch()
338
+
339
  btn.click(infer, inputs=[textbox, char_dropdown, language_dropdown, duration_slider, noise_scale_slider, noise_scale_w_slider, symbol_input],
340
+ outputs=[text_output, audio_output, phoneme_output, duration_output], api_name="1")
341
  cus_dur_gn_btn.click(infer_from_phoneme_dur, inputs=[duration_output, char_dropdown, duration_slider, noise_scale_slider, noise_scale_w_slider],
342
+ outputs=[phoneme_output, audio_output], api_name="2")
343
 
344
  examples = [['haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......haa\u2193......', '29:米浴', '日本語', 1, 0.667, 0.8, True],
345
  ['お疲れ様です,トレーナーさん。', '1:无声铃鹿', '日本語', 1, 0.667, 0.8, False],