-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
28 lines (24 loc) · 978 Bytes
/
app.py
File metadata and controls
28 lines (24 loc) · 978 Bytes
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
import gradio as gr
from service import Service
def doctor_bot(message, history):
service = Service()
return service.answer(message, history)
css = '''
.gradio-container { max-width:850px !important; margin:20px auto !important;}
.message { padding: 10px !important; font-size: 14px !important;}
'''
demo = gr.ChatInterface(
css = css,
fn = doctor_bot,
title = '心宝',
chatbot = gr.Chatbot(height=400, bubble_full_width=False),
theme = gr.themes.Default(spacing_size='sm', radius_size='sm'),
textbox=gr.Textbox(placeholder="在此输入您的问题", container=False, scale=7),
examples = ['你好,你叫什么名字?', '抑郁症有什么症状?', '失眠吃什么药?', '感到孤独怎么办?'],
submit_btn = gr.Button('提交', variant='primary'),
clear_btn = gr.Button('清空记录'),
retry_btn = None,
undo_btn = None,
)
if __name__ == '__main__':
demo.launch(share=True)