SysModeler commited on
Commit
3659290
·
verified ·
1 Parent(s): 898e94f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -256,7 +256,14 @@ def sysml_chatbot(message, history):
256
  return answer, history
257
 
258
  # Gradio UI
259
- with gr.Blocks() as demo:
 
 
 
 
 
 
 
260
 
261
  gr.Markdown("## SysModeler Chatbot")
262
 
@@ -270,14 +277,14 @@ with gr.Blocks() as demo:
270
  show_label=False
271
  )
272
  with gr.Column(scale=1, min_width=50):
273
- submit_btn = gr.Button("➤")
274
 
275
  clear = gr.Button("Clear")
276
 
277
  state = gr.State(history)
278
 
279
- submit_btn.click(fn=sysml_chatbot, inputs=[msg, state], outputs=[msg, chatbot])
280
- msg.submit(fn=sysml_chatbot, inputs=[msg, state], outputs=[msg, chatbot]) # still supports enter key
281
  clear.click(fn=lambda: ([], ""), inputs=None, outputs=[chatbot, msg])
282
 
283
  if __name__ == "__main__":
 
256
  return answer, history
257
 
258
  # Gradio UI
259
+ with gr.Blocks(css="""
260
+ #submit-btn {
261
+ height: 100%;
262
+ background-color: #48CAE4;
263
+ color: white;
264
+ font-size: 1.5em;
265
+ }
266
+ """) as demo:
267
 
268
  gr.Markdown("## SysModeler Chatbot")
269
 
 
277
  show_label=False
278
  )
279
  with gr.Column(scale=1, min_width=50):
280
+ submit_btn = gr.Button("➤", scale=1, elem_id="submit-btn")
281
 
282
  clear = gr.Button("Clear")
283
 
284
  state = gr.State(history)
285
 
286
+ submit_btn.click(fn=sysml_chatbot, inputs=[msg, state], outputs=[gr.Textbox.update(value=""), chatbot])
287
+ msg.submit(fn=sysml_chatbot, inputs=[msg, state], outputs=[gr.Textbox.update(value=""), chatbot])
288
  clear.click(fn=lambda: ([], ""), inputs=None, outputs=[chatbot, msg])
289
 
290
  if __name__ == "__main__":