Spaces:
Sleeping
Sleeping
Update utils/chatbot_interface2.py
Browse files- 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 |
-
#
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
|
122 |
-
#
|
123 |
-
|
124 |
-
|
125 |
-
|
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 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
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 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
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
|