SysModeler commited on
Commit
4ace9ff
·
verified ·
1 Parent(s): 4f1c25a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -4
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
- chatbot = gr.Chatbot()
71
- msg = gr.Textbox(placeholder="Ask me about SysML diagrams or concepts...")
 
 
 
 
 
 
 
 
 
 
 
72
  clear = gr.Button("Clear")
73
 
74
  state = gr.State(history)
75
 
76
- msg.submit(sysml_chatbot, [msg, state], [msg, chatbot])
77
- clear.click(lambda: ([], ""), None, [chatbot, msg])
 
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()