AashitaK commited on
Commit
3531378
·
verified ·
1 Parent(s): 7411303

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -4
app.py CHANGED
@@ -83,18 +83,28 @@ with gr.Blocks() as demo:
83
 
84
  with gr.Row():
85
  # Output box always visible with initial placeholder
86
- output = gr.Markdown(
 
87
  label=chatbot_output_label,
88
- value=chatbot_output_placeholder
 
89
  )
90
 
 
91
  with gr.Row():
92
- submit = gr.Button(chatbot_submit_button)
93
- reset = gr.Button(chatbot_reset_button)
 
 
 
 
94
 
95
  # Define button click actions
96
  submit.click(fn=chatbot, inputs=user_input, outputs=output)
97
  reset.click(fn=reset_output, inputs=None, outputs=output)
98
 
 
 
 
99
  if __name__ == "__main__":
100
  demo.launch()
 
83
 
84
  with gr.Row():
85
  # Output box always visible with initial placeholder
86
+ output = gr.Textbox(
87
+ lines=7,
88
  label=chatbot_output_label,
89
+ value=chatbot_output_placeholder,
90
+ interactive=False
91
  )
92
 
93
+ # Place Reset on the Left and Submit on the Right
94
  with gr.Row():
95
+ # Reset button with secondary (gray) color
96
+ reset = gr.Button(chatbot_reset_button, variant="secondary")
97
+ # Spacer to push Submit to the right
98
+ gr.Spacer()
99
+ # Submit button with primary (blue) color
100
+ submit = gr.Button(chatbot_submit_button, variant="primary")
101
 
102
  # Define button click actions
103
  submit.click(fn=chatbot, inputs=user_input, outputs=output)
104
  reset.click(fn=reset_output, inputs=None, outputs=output)
105
 
106
+ # Enable "Enter" key to submit
107
+ user_input.submit(fn=chatbot, inputs=user_input, outputs=output)
108
+
109
  if __name__ == "__main__":
110
  demo.launch()