Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,16 +2,14 @@ import gradio as gr
|
|
| 2 |
from datetime import datetime
|
| 3 |
|
| 4 |
def search(query, collections):
|
| 5 |
-
# Placeholder function for custom RAG integration
|
| 6 |
response = f"Results for query: {query} from collections: {', '.join(collections)}"
|
| 7 |
return response
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
|
|
|
| 11 |
|
| 12 |
-
|
| 13 |
-
def toggle_advanced_options(is_clicked, collections_visibility):
|
| 14 |
-
return not collections_visibility
|
| 15 |
|
| 16 |
app = gr.Blocks()
|
| 17 |
|
|
@@ -28,14 +26,9 @@ with app:
|
|
| 28 |
search_button = gr.Button("Search")
|
| 29 |
output_chat = gr.Textbox(label="Results", lines=6, interactive=True)
|
| 30 |
|
| 31 |
-
advanced_options_button.click(fn=toggle_advanced_options,
|
| 32 |
-
inputs=advanced_options_button,
|
| 33 |
-
outputs=collections,
|
| 34 |
-
_js="(is_clicked, collections_visibility) => [!collections_visibility]")
|
| 35 |
|
| 36 |
-
search_button.click(fn=search,
|
| 37 |
-
inputs=[query_input, collections],
|
| 38 |
-
outputs=output_chat)
|
| 39 |
|
| 40 |
if __name__ == "__main__":
|
| 41 |
app.launch()
|
|
|
|
| 2 |
from datetime import datetime
|
| 3 |
|
| 4 |
def search(query, collections):
|
|
|
|
| 5 |
response = f"Results for query: {query} from collections: {', '.join(collections)}"
|
| 6 |
return response
|
| 7 |
|
| 8 |
+
def toggle_advanced_options(_):
|
| 9 |
+
collections.visible = not collections.visible
|
| 10 |
+
return gr.update(visible=collections.visible)
|
| 11 |
|
| 12 |
+
last_updated_date = datetime.now().strftime("%B %d, %Y")
|
|
|
|
|
|
|
| 13 |
|
| 14 |
app = gr.Blocks()
|
| 15 |
|
|
|
|
| 26 |
search_button = gr.Button("Search")
|
| 27 |
output_chat = gr.Textbox(label="Results", lines=6, interactive=True)
|
| 28 |
|
| 29 |
+
advanced_options_button.click(fn=toggle_advanced_options, inputs=None, outputs=None)
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
+
search_button.click(fn=search, inputs=[query_input, collections], outputs=output_chat)
|
|
|
|
|
|
|
| 32 |
|
| 33 |
if __name__ == "__main__":
|
| 34 |
app.launch()
|