AashitaK commited on
Commit
6ab684f
·
verified ·
1 Parent(s): f3ea618

Update utils/chatbot_interface2.py

Browse files
Files changed (1) hide show
  1. utils/chatbot_interface2.py +28 -28
utils/chatbot_interface2.py CHANGED
@@ -112,31 +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
- # 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(self, user_message, chat_history):
@@ -172,11 +172,11 @@ class ChatbotInterface:
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
 
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(self, user_message, chat_history):
 
172
  inputs=[user_input, chatbot_output],
173
  outputs=[chatbot_output, user_input]
174
  )
175
+ reset.click(
176
+ fn=self.reset_output,
177
+ inputs=None,
178
+ outputs=chatbot_output
179
+ )
180
 
181
  logging.info("Gradio interface created successfully.")
182
  return demo