forked from resautu/chat-with-Elysia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
33 lines (33 loc) · 1.41 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import gradio as gr
import webbrowser
import argparse
from parse import Parse
import torch
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--device', type=str, default='cpu')
parser.add_argument('--api', action="store_true", default=False)
parser.add_argument("--share", action="store_true", default=False, help="share gradio app")
parser.add_argument("--colab", action="store_true", default=False, help="share gradio app")
args = parser.parse_args()
ps = Parse()
print(torch.__version__)
with gr.Blocks() as app:
gr.Markdown(
"# <center> chat with Elysia\n"
"### <center> base on chat gpt3.5 and vits\n"
)
with gr.Row():
with gr.Column():
textbox = gr.TextArea(label="对话内容",
placeholder="Type your sentence here",
value="你好!", elem_id=f"tts-input")
with gr.Column():
text_output = gr.Textbox(label="回复信息")
audio_output = gr.Audio(label="音频信息", elem_id="tts-audio")
btn = gr.Button("生成对话")
btn.click(ps.PipeChat,
inputs=[textbox],
outputs=[text_output, audio_output])
webbrowser.open("http://127.0.0.1:7860")
app.launch(share=args.share)