ECUiVADE commited on
Commit
549684b
1 Parent(s): d19dd62

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -9
app.py CHANGED
@@ -79,12 +79,26 @@ def AIPatient(message):
79
  return history
80
 
81
  with gr.Blocks() as demo:
82
- gr.Markdown("# AI Patient Chatbot")
83
- with gr.Group():
84
- with gr.Tab("Patient Chatbot"):
85
- chatbot = gr.Chatbot()
86
- message = gr.Textbox(label="Enter your message to Barry", placeholder="Type here...", lines=2)
87
- send_message = gr.Button("Submit")
88
- send_message.click(AIPatient, inputs=[message], outputs=[chatbot])
89
- save_chatlog = gr.Button("Save Chatlog")
90
- #send_message.click(SaveChatlog, inputs=[message], outputs=[chatbot])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  return history
80
 
81
  with gr.Blocks() as demo:
82
+ gr.HTML("""<h1 align="center">So Rude</h1>""")
83
+
84
+ chatbot = gr.Chatbot()
85
+ with gr.Row():
86
+ with gr.Column(scale=4):
87
+ user_input = gr.Textbox(show_label=False, placeholder="Input...", lines=8, elem_id="user_input")
88
+ submitBtn = gr.Button("Submit", variant="primary", elem_id="submit_btn")
89
+ with gr.Column(scale=1):
90
+ max_length = gr.Slider(0, 256, value=64, step=1.0, label="Maximum Length", interactive=True)
91
+ top_p = gr.Slider(0, 1, value=0.7, step=0.01, label="Top P", interactive=True)
92
+ temperature = gr.Slider(0, 2.0, value=0.95, step=0.01, label="Temperature", interactive=True)
93
+ emptyBtn = gr.Button("Clear History")
94
+
95
+ history = gr.State([])
96
+
97
+ submitBtn.click(
98
+ predict, [user_input, chatbot, max_length, top_p, temperature, history], [chatbot, history], show_progress=True
99
+ )
100
+ submitBtn.click(reset_user_input, [], [user_input])
101
+
102
+ emptyBtn.click(reset_state, outputs=[chatbot, history], show_progress=True)
103
+
104
+ demo.queue().launch(share=False, inbrowser=True)