Update app.py
Browse files
app.py
CHANGED
@@ -196,12 +196,12 @@ def main():
|
|
196 |
}
|
197 |
"""
|
198 |
|
199 |
-
logo_path = "
|
200 |
-
logo_exists = os.path.exists(logo_path)
|
201 |
|
202 |
# Create Gradio UI
|
203 |
with gr.Blocks(css=custom_css) as ui:
|
204 |
-
if
|
|
|
205 |
gr.Image(logo_path, elem_id="logo", show_label=False, height=100, width=200)
|
206 |
else:
|
207 |
gr.Markdown("<h2 style='text-align: center;'>Equinix</h2>")
|
@@ -231,13 +231,15 @@ def main():
|
|
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 |
-
# Button Click Events
|
241 |
submit_button.click(
|
242 |
lambda query, method: query_router(query, method, retriever),
|
243 |
inputs=[query_input, query_method],
|
@@ -255,8 +257,7 @@ def main():
|
|
255 |
)
|
256 |
|
257 |
# Launch UI
|
258 |
-
ui.launch(share=True)
|
259 |
-
|
260 |
|
261 |
if __name__ == "__main__":
|
262 |
main()
|
|
|
196 |
}
|
197 |
"""
|
198 |
|
199 |
+
logo_path = "Equinix-LOGO.jpeg" # Make sure this file exists or update the path
|
|
|
200 |
|
201 |
# Create Gradio UI
|
202 |
with gr.Blocks(css=custom_css) as ui:
|
203 |
+
# Check if logo exists before trying to display it
|
204 |
+
if os.path.exists(logo_path):
|
205 |
gr.Image(logo_path, elem_id="logo", show_label=False, height=100, width=200)
|
206 |
else:
|
207 |
gr.Markdown("<h2 style='text-align: center;'>Equinix</h2>")
|
|
|
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 |
+
# Output Textbox - Define it BEFORE you reference it in any callbacks
|
235 |
+
output_box = gr.Textbox(label="Response", interactive=False)
|
236 |
+
|
237 |
# Buttons Section
|
238 |
with gr.Row():
|
239 |
submit_button = gr.Button("Submit")
|
240 |
+
reset_button = gr.Button("Reset Query")
|
241 |
|
242 |
+
# Button Click Events - Now output_box is defined before it's used in these callbacks
|
|
|
243 |
submit_button.click(
|
244 |
lambda query, method: query_router(query, method, retriever),
|
245 |
inputs=[query_input, query_method],
|
|
|
257 |
)
|
258 |
|
259 |
# Launch UI
|
260 |
+
ui.launch(share=True)
|
|
|
261 |
|
262 |
if __name__ == "__main__":
|
263 |
main()
|