Spaces:
Build error
Build error
SayaSS
commited on
Commit
•
d595ee0
1
Parent(s):
37cf9cd
add api option
Browse files
app.py
CHANGED
@@ -107,6 +107,7 @@ download_audio_js = """
|
|
107 |
if __name__ == '__main__':
|
108 |
parser = argparse.ArgumentParser()
|
109 |
parser.add_argument('--device', type=str, default='cpu')
|
|
|
110 |
parser.add_argument("--share", action="store_true", default=False, help="share gradio app")
|
111 |
args = parser.parse_args()
|
112 |
device = torch.device(args.device)
|
@@ -236,7 +237,7 @@ if __name__ == '__main__':
|
|
236 |
o1 = gr.Textbox(label="输出信息")
|
237 |
o2 = gr.Audio(label="输出音频", elem_id=f"tts-audio-zh-{name_zh}")
|
238 |
download = gr.Button("下载音频")
|
239 |
-
btn.click(tts_fn, inputs=[input_text, lang, ns, nsw, ls, symbol_input], outputs=[o1, o2])
|
240 |
download.click(None, [], [], _js=download_audio_js.format(audio_id=f"zh-{name_zh}"))
|
241 |
lang.change(change_lang, inputs=[lang], outputs=[ns, nsw, ls])
|
242 |
symbol_input.change(
|
@@ -264,4 +265,4 @@ if __name__ == '__main__':
|
|
264 |
window.scrollTo(x, y);
|
265 |
return text_input.value;
|
266 |
}}""")
|
267 |
-
app.queue(concurrency_count=1).launch(
|
|
|
107 |
if __name__ == '__main__':
|
108 |
parser = argparse.ArgumentParser()
|
109 |
parser.add_argument('--device', type=str, default='cpu')
|
110 |
+
parser.add_argument('--api', action="store_true", default=False)
|
111 |
parser.add_argument("--share", action="store_true", default=False, help="share gradio app")
|
112 |
args = parser.parse_args()
|
113 |
device = torch.device(args.device)
|
|
|
237 |
o1 = gr.Textbox(label="输出信息")
|
238 |
o2 = gr.Audio(label="输出音频", elem_id=f"tts-audio-zh-{name_zh}")
|
239 |
download = gr.Button("下载音频")
|
240 |
+
btn.click(tts_fn, inputs=[input_text, lang, ns, nsw, ls, symbol_input], outputs=[o1, o2], api_name="tts")
|
241 |
download.click(None, [], [], _js=download_audio_js.format(audio_id=f"zh-{name_zh}"))
|
242 |
lang.change(change_lang, inputs=[lang], outputs=[ns, nsw, ls])
|
243 |
symbol_input.change(
|
|
|
265 |
window.scrollTo(x, y);
|
266 |
return text_input.value;
|
267 |
}}""")
|
268 |
+
app.queue(concurrency_count=1, api_open=args.api).launch(share=args.share)
|