Spaces:
Running
on
T4
Running
on
T4
update app.py for collection name
Browse files
app.py
CHANGED
@@ -16,8 +16,8 @@ except Exception as e:
|
|
16 |
# ---------------------------------------------------------------------
|
17 |
|
18 |
def retrieve(
|
19 |
-
query:
|
20 |
-
collection_name:
|
21 |
filter_metadata:list[dict] = None,
|
22 |
) -> list:
|
23 |
"""
|
@@ -59,30 +59,24 @@ with gr.Blocks() as ui:
|
|
59 |
placeholder="Enter your search query here",
|
60 |
info="The query to search for in the vector database"
|
61 |
)
|
62 |
-
|
63 |
-
label="
|
64 |
lines=1,
|
65 |
-
placeholder="
|
66 |
-
info="
|
67 |
)
|
68 |
sources_input = gr.Textbox(
|
69 |
-
label="Sources Filter (optional)",
|
70 |
lines=1,
|
71 |
-
placeholder="
|
72 |
info="Filter by document source type (leave empty for all)"
|
73 |
)
|
74 |
subtype_input = gr.Textbox(
|
75 |
-
label="
|
76 |
lines=1,
|
77 |
-
placeholder="
|
78 |
info="Filter by document subtype (leave empty for all)"
|
79 |
)
|
80 |
-
year_input = gr.Textbox(
|
81 |
-
label="Year Filter (optional)",
|
82 |
-
lines=1,
|
83 |
-
placeholder="2023, 2024",
|
84 |
-
info="Comma-separated list of years to filter by (leave empty for all)"
|
85 |
-
)
|
86 |
|
87 |
submit_btn = gr.Button("Submit", variant="primary")
|
88 |
|
@@ -97,7 +91,7 @@ with gr.Blocks() as ui:
|
|
97 |
# UI event handler
|
98 |
submit_btn.click(
|
99 |
fn=retrieve,
|
100 |
-
inputs=[query_input],
|
101 |
outputs=output,
|
102 |
api_name="retrieve"
|
103 |
)
|
|
|
16 |
# ---------------------------------------------------------------------
|
17 |
|
18 |
def retrieve(
|
19 |
+
query:str,
|
20 |
+
collection_name:str = None,
|
21 |
filter_metadata:list[dict] = None,
|
22 |
) -> list:
|
23 |
"""
|
|
|
59 |
placeholder="Enter your search query here",
|
60 |
info="The query to search for in the vector database"
|
61 |
)
|
62 |
+
collection_name = gr.Textbox(
|
63 |
+
label="Collection Name (optional)",
|
64 |
lines=1,
|
65 |
+
placeholder="EUDR, Humboldt",
|
66 |
+
info="Name of the collection"
|
67 |
)
|
68 |
sources_input = gr.Textbox(
|
69 |
+
label="Sources Filter key to be looked in metadata (optional)",
|
70 |
lines=1,
|
71 |
+
placeholder="country",
|
72 |
info="Filter by document source type (leave empty for all)"
|
73 |
)
|
74 |
subtype_input = gr.Textbox(
|
75 |
+
label="Value in filter to be looked for(optional)",
|
76 |
lines=1,
|
77 |
+
placeholder="Ecuador, Guatemala",
|
78 |
info="Filter by document subtype (leave empty for all)"
|
79 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
submit_btn = gr.Button("Submit", variant="primary")
|
82 |
|
|
|
91 |
# UI event handler
|
92 |
submit_btn.click(
|
93 |
fn=retrieve,
|
94 |
+
inputs=[query_input,collection_name],
|
95 |
outputs=output,
|
96 |
api_name="retrieve"
|
97 |
)
|
utils/__pycache__/retriever.cpython-311.pyc
CHANGED
Binary files a/utils/__pycache__/retriever.cpython-311.pyc and b/utils/__pycache__/retriever.cpython-311.pyc differ
|
|
utils/__pycache__/utils.cpython-311.pyc
CHANGED
Binary files a/utils/__pycache__/utils.cpython-311.pyc and b/utils/__pycache__/utils.cpython-311.pyc differ
|
|
utils/__pycache__/vectorstore_interface.cpython-311.pyc
CHANGED
Binary files a/utils/__pycache__/vectorstore_interface.cpython-311.pyc and b/utils/__pycache__/vectorstore_interface.cpython-311.pyc differ
|
|