AashitaK commited on
Commit
7c9e098
·
verified ·
1 Parent(s): 7e02e0d

Update utils/chatbot_interface2.py

Browse files
Files changed (1) hide show
  1. utils/chatbot_interface2.py +29 -15
utils/chatbot_interface2.py CHANGED
@@ -112,17 +112,31 @@ class ChatbotInterface:
112
  # Chatbot history component
113
  chatbot_output = gr.Chatbot(label=self.output_label, type="messages")
114
 
115
- # User input
116
- user_input = gr.Textbox(
117
- lines=2,
118
- label=self.input_label,
119
- placeholder=self.input_placeholder
120
- )
 
 
 
 
 
121
 
122
- # Buttons
123
- with gr.Row():
124
- reset = gr.Button(self.reset_button, variant="secondary")
125
- submit = gr.Button(self.submit_button, variant="primary")
 
 
 
 
 
 
 
 
 
126
 
127
  # Define a local function to process input:
128
  def process_input(user_message, chat_history):
@@ -158,11 +172,11 @@ class ChatbotInterface:
158
  inputs=[user_input, chatbot_output],
159
  outputs=[chatbot_output, user_input]
160
  )
161
- reset.click(
162
- fn=self.process_input#reset_output,
163
- inputs=None,
164
- outputs=[chatbot_output, user_input]
165
- )
166
 
167
  logging.info("Gradio interface created successfully.")
168
  return demo
 
112
  # Chatbot history component
113
  chatbot_output = gr.Chatbot(label=self.output_label, type="messages")
114
 
115
+ # # User input
116
+ # user_input = gr.Textbox(
117
+ # lines=2,
118
+ # label=self.input_label,
119
+ # placeholder=self.input_placeholder
120
+ # )
121
+
122
+ # # Buttons
123
+ # with gr.Row():
124
+ # reset = gr.Button(self.reset_button, variant="secondary")
125
+ # submit = gr.Button(self.submit_button, variant="primary")
126
 
127
+ # Use a gr.Row container as the input box with an integrated submit button.
128
+ with gr.Row(elem_id="input-container"):
129
+ user_input = gr.Textbox(
130
+ lines=1,
131
+ show_label=False, # Hide label for a unified look.
132
+ placeholder=self.input_placeholder,
133
+ elem_id="chat-input"
134
+ )
135
+ submit = gr.Button(
136
+ value="→",
137
+ variant="primary",
138
+ elem_id="ask-button"
139
+ )
140
 
141
  # Define a local function to process input:
142
  def process_input(user_message, chat_history):
 
172
  inputs=[user_input, chatbot_output],
173
  outputs=[chatbot_output, user_input]
174
  )
175
+ # reset.click(
176
+ # fn=self.process_input#reset_output,
177
+ # inputs=None,
178
+ # outputs=[chatbot_output, user_input]
179
+ # )
180
 
181
  logging.info("Gradio interface created successfully.")
182
  return demo