Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -67,14 +67,26 @@ def sysml_chatbot(message, history):
|
|
67 |
# Gradio UI
|
68 |
with gr.Blocks() as demo:
|
69 |
gr.Markdown("## SysModeler Chatbot")
|
70 |
-
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
clear = gr.Button("Clear")
|
73 |
|
74 |
state = gr.State(history)
|
75 |
|
76 |
-
|
77 |
-
|
|
|
78 |
|
79 |
if __name__ == "__main__":
|
80 |
demo.launch()
|
|
|
67 |
# Gradio UI
|
68 |
with gr.Blocks() as demo:
|
69 |
gr.Markdown("## SysModeler Chatbot")
|
70 |
+
|
71 |
+
chatbot = gr.Chatbot(height=500)
|
72 |
+
|
73 |
+
with gr.Row():
|
74 |
+
with gr.Column(scale=8):
|
75 |
+
msg = gr.Textbox(
|
76 |
+
placeholder="Ask me about SysML diagrams or concepts...",
|
77 |
+
lines=3,
|
78 |
+
show_label=False
|
79 |
+
)
|
80 |
+
with gr.Column(scale=1, min_width=80):
|
81 |
+
submit_btn = gr.Button("➤")
|
82 |
+
|
83 |
clear = gr.Button("Clear")
|
84 |
|
85 |
state = gr.State(history)
|
86 |
|
87 |
+
submit_btn.click(fn=sysml_chatbot, inputs=[msg, state], outputs=[msg, chatbot])
|
88 |
+
msg.submit(fn=sysml_chatbot, inputs=[msg, state], outputs=[msg, chatbot]) # still supports enter key
|
89 |
+
clear.click(fn=lambda: ([], ""), inputs=None, outputs=[chatbot, msg])
|
90 |
|
91 |
if __name__ == "__main__":
|
92 |
demo.launch()
|