Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,6 +23,7 @@ import translators.server as tss
|
|
| 23 |
import psutil
|
| 24 |
from datetime import datetime
|
| 25 |
from text.cleaners import japanese_cleaners
|
|
|
|
| 26 |
|
| 27 |
def audio_postprocess(self, y):
|
| 28 |
if y is None:
|
|
@@ -246,6 +247,24 @@ def monkey_patch():
|
|
| 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")
|
|
@@ -337,9 +356,9 @@ if __name__ == "__main__":
|
|
| 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]
|
| 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]
|
| 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],
|
|
|
|
| 23 |
import psutil
|
| 24 |
from datetime import datetime
|
| 25 |
from text.cleaners import japanese_cleaners
|
| 26 |
+
from gradio import routes
|
| 27 |
|
| 28 |
def audio_postprocess(self, y):
|
| 29 |
if y is None:
|
|
|
|
| 247 |
return y
|
| 248 |
gr.blocks.BlockContext.postprocess = postprocess
|
| 249 |
|
| 250 |
+
def get_types(cls_set: List[Type], component: str):
|
| 251 |
+
docset = []
|
| 252 |
+
types = []
|
| 253 |
+
if component == "input":
|
| 254 |
+
for cls in cls_set:
|
| 255 |
+
doc = inspect.getdoc(cls)
|
| 256 |
+
doc_lines = doc.split("\n")
|
| 257 |
+
docset.append(doc_lines[1].split(":")[-1])
|
| 258 |
+
types.append(doc_lines[1].split(")")[0].split("(")[-1])
|
| 259 |
+
else:
|
| 260 |
+
for cls in cls_set:
|
| 261 |
+
doc = inspect.getdoc(cls)
|
| 262 |
+
doc_lines = doc.split("\n")
|
| 263 |
+
docset.append(doc_lines[-1].split(":")[-1])
|
| 264 |
+
types.append(doc_lines[-1].split(")")[0].split("(")[-1])
|
| 265 |
+
return docset, types
|
| 266 |
+
routes.get_types = get_types
|
| 267 |
+
|
| 268 |
if __name__ == "__main__":
|
| 269 |
parser = argparse.ArgumentParser()
|
| 270 |
parser.add_argument("--share", action="store_true", default=False, help="share gradio app")
|
|
|
|
| 356 |
monkey_patch()
|
| 357 |
|
| 358 |
btn.click(infer, inputs=[textbox, char_dropdown, language_dropdown, duration_slider, noise_scale_slider, noise_scale_w_slider, symbol_input],
|
| 359 |
+
outputs=[text_output, audio_output, phoneme_output, duration_output])#, api_name="1")
|
| 360 |
cus_dur_gn_btn.click(infer_from_phoneme_dur, inputs=[duration_output, char_dropdown, duration_slider, noise_scale_slider, noise_scale_w_slider],
|
| 361 |
+
outputs=[phoneme_output, audio_output])#, api_name="2")
|
| 362 |
|
| 363 |
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],
|
| 364 |
['お疲れ様です,トレーナーさん。', '1:无声铃鹿', '日本語', 1, 0.667, 0.8, False],
|