AashitaK commited on
Commit
76dff7b
·
verified ·
1 Parent(s): 9394a1f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -8
app.py CHANGED
@@ -75,12 +75,13 @@ class ChatbotInterface:
75
  # Chatbot history component
76
  chatbot_output = gr.Chatbot(label=self.output_label)
77
 
78
- # User input
79
- user_input = gr.Textbox(
80
- lines=2,
81
- label=self.input_label,
82
- placeholder=self.input_placeholder
83
- )
 
84
 
85
  # # Buttons
86
  # with gr.Row():
@@ -92,9 +93,20 @@ class ChatbotInterface:
92
  # user_input.submit(fn=conversation, inputs=[user_input, chatbot_output], outputs=chatbot_output)
93
  # reset.click(fn=self.reset_output, inputs=None, outputs=chatbot_output)
94
 
95
- # Allow submitting input with Enter key
 
 
 
 
 
 
 
 
 
96
  user_input.submit(fn=conversation, inputs=[user_input, chatbot_output], outputs=chatbot_output)
97
-
 
 
98
 
99
  logging.info("Gradio interface created successfully.")
100
  return demo
 
75
  # Chatbot history component
76
  chatbot_output = gr.Chatbot(label=self.output_label)
77
 
78
+ # # User input
79
+ # user_input = gr.Textbox(
80
+ # lines=2,
81
+ # label=self.input_label,
82
+ # placeholder=self.input_placeholder
83
+ # )
84
+
85
 
86
  # # Buttons
87
  # with gr.Row():
 
93
  # user_input.submit(fn=conversation, inputs=[user_input, chatbot_output], outputs=chatbot_output)
94
  # reset.click(fn=self.reset_output, inputs=None, outputs=chatbot_output)
95
 
96
+ # User input with send button
97
+ with gr.Row():
98
+ user_input = gr.Textbox(
99
+ lines=2,
100
+ label=self.input_label,
101
+ placeholder=self.input_placeholder
102
+ )
103
+ send_button = gr.Button("➤", size="sm") # Small send button like ChatGPT
104
+
105
+ # Enable Enter key submission
106
  user_input.submit(fn=conversation, inputs=[user_input, chatbot_output], outputs=chatbot_output)
107
+
108
+ # Enable send button click submission
109
+ send_button.click(fn=conversation, inputs=[user_input, chatbot_output], outputs=chatbot_output)
110
 
111
  logging.info("Gradio interface created successfully.")
112
  return demo