Update app.py
Browse files
app.py
CHANGED
|
@@ -161,6 +161,11 @@ def query_router(query, method, retriever):
|
|
| 161 |
return general_query(query)
|
| 162 |
return "Invalid selection!"
|
| 163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
# Function to update the clock
|
| 165 |
def update_datetime():
|
| 166 |
date, time = get_current_datetime()
|
|
@@ -225,10 +230,13 @@ def main():
|
|
| 225 |
with gr.Row():
|
| 226 |
query_input = gr.Textbox(label="Enter your query")
|
| 227 |
query_method = gr.Dropdown(["Team Query", "General Query"], label="Select Query Type", value="Team Query")
|
| 228 |
-
|
| 229 |
-
# Button for submitting query
|
| 230 |
-
submit_button = gr.Button("Submit")
|
| 231 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
# Output Textbox
|
| 233 |
output_box = gr.Textbox(label="Response", interactive=False)
|
| 234 |
|
|
@@ -238,7 +246,14 @@ def main():
|
|
| 238 |
inputs=[query_input, query_method],
|
| 239 |
outputs=output_box
|
| 240 |
)
|
|
|
|
|
|
|
|
|
|
| 241 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
# This callback will update the date and time whenever the user submits a query
|
| 243 |
submit_button.click(
|
| 244 |
fn=update_datetime,
|
|
|
|
| 161 |
return general_query(query)
|
| 162 |
return "Invalid selection!"
|
| 163 |
|
| 164 |
+
# Function to reset input and output
|
| 165 |
+
def reset_fields():
|
| 166 |
+
return "", None, "" # Reset query input, dropdown, and output
|
| 167 |
+
|
| 168 |
+
|
| 169 |
# Function to update the clock
|
| 170 |
def update_datetime():
|
| 171 |
date, time = get_current_datetime()
|
|
|
|
| 230 |
with gr.Row():
|
| 231 |
query_input = gr.Textbox(label="Enter your query")
|
| 232 |
query_method = gr.Dropdown(["Team Query", "General Query"], label="Select Query Type", value="Team Query")
|
|
|
|
|
|
|
|
|
|
| 233 |
|
| 234 |
+
# Buttons Section
|
| 235 |
+
with gr.Row():
|
| 236 |
+
submit_button = gr.Button("Submit")
|
| 237 |
+
reset_button = gr.Button("Reset")
|
| 238 |
+
|
| 239 |
+
|
| 240 |
# Output Textbox
|
| 241 |
output_box = gr.Textbox(label="Response", interactive=False)
|
| 242 |
|
|
|
|
| 246 |
inputs=[query_input, query_method],
|
| 247 |
outputs=output_box
|
| 248 |
)
|
| 249 |
+
|
| 250 |
+
# Output Textbox
|
| 251 |
+
output_box = gr.Textbox(label="Response", interactive=False)
|
| 252 |
|
| 253 |
+
# Button Click Events
|
| 254 |
+
reset_button.click(reset_fields, inputs=[], outputs=[query_input, query_method, output_box])
|
| 255 |
+
|
| 256 |
+
|
| 257 |
# This callback will update the date and time whenever the user submits a query
|
| 258 |
submit_button.click(
|
| 259 |
fn=update_datetime,
|