Spaces:
Sleeping
Sleeping
updated gradio interface
Browse files
app.py
CHANGED
@@ -110,19 +110,31 @@ def bot(history,temperature, max_new_tokens, top_p,top_k):
|
|
110 |
|
111 |
|
112 |
with gr.Blocks() as demo:
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
-
chatbot = gr.Chatbot()
|
119 |
-
msg = gr.Textbox()
|
120 |
-
submit = gr.Button("Submit")
|
121 |
-
clear = gr.Button("Clear")
|
122 |
-
|
123 |
-
examples = gr.Examples(examples=["Halo dokter", "Dokter aku flu, aku harus apa?"],inputs=[msg])
|
124 |
-
|
125 |
-
#submit.click(bot,[msg,chatbot,temperature, max_length, top_p,top_k],chatbot)
|
126 |
submit.click(user, [msg, chatbot], [msg, chatbot], queue=False).then(
|
127 |
bot, [chatbot,temperature,max_length,top_p,top_k], chatbot
|
128 |
)
|
|
|
110 |
|
111 |
|
112 |
with gr.Blocks() as demo:
|
113 |
+
gr.Markdown(
|
114 |
+
"""# ChatDoctor - PolyLM 1.7b 🩺
|
115 |
+
|
116 |
+
A [ChatDoctor - PolyLM 1.7b](https://huggingface.co/fadliaulawi/polylm-1.7b-finetuned) demo.
|
117 |
+
From the [PolyLM 1.7b](https://huggingface.co/DAMO-NLP-MT/polylm-1.7b) model and finetuned on [ChatDoctor](https://github.com/Kent0n-Li/ChatDoctor) dataset.
|
118 |
+
|
119 |
+
"""
|
120 |
+
)
|
121 |
+
with gr.Row() as row:
|
122 |
+
with gr.Column():
|
123 |
+
msg = gr.Textbox()
|
124 |
+
temperature = gr.Slider(0, 5, value=0.8, step=0.1, label='Temperature')
|
125 |
+
max_length = gr.Slider(0, 1024, value=50, step=1, label='Max Length')
|
126 |
+
top_p = gr.Slider(0, 1, value=0.8, step=0.1, label='Top P')
|
127 |
+
top_k = gr.Slider(0, 50, value=10, step=1, label='Top K')
|
128 |
+
submit = gr.Button("Submit")
|
129 |
+
clear = gr.Button("Clear")
|
130 |
+
with gr.Column():
|
131 |
+
chatbot = gr.Chatbot()
|
132 |
+
examples = gr.Examples(examples=["Dokter, aku merasa sangat depresi akhir-akhir ini dan juga mengalami perubahan suhu tubuhku.",
|
133 |
+
"Dokter, aku mengalami kelelahan akhir-akhir ini.",
|
134 |
+
"Dokter, aku merasa pusing, lemah dan sakit dada tajam akhir-akhir ini.",
|
135 |
+
"Dokter, saya sudah beberapa minggu mengalami suara serak dan tidak kunjung membaik meski sudah minum obat. Apa masalahnya?"
|
136 |
+
],inputs=[msg])
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
submit.click(user, [msg, chatbot], [msg, chatbot], queue=False).then(
|
139 |
bot, [chatbot,temperature,max_length,top_p,top_k], chatbot
|
140 |
)
|