Update app.py
Browse files
app.py
CHANGED
@@ -41,18 +41,21 @@ def main():
|
|
41 |
languages = ['English', 'Hindi', 'Bengali', 'Marathi', 'Telugu', 'Tamil', 'Gujarati', 'Kannada', 'Odia', 'Malayalam', 'Panjabi', 'Assamese']
|
42 |
|
43 |
# Multiselect for choosing languages
|
44 |
-
selected_languages = st.multiselect('Select languages for search results', languages)
|
45 |
|
46 |
-
# filter_year = st.sidebar.slider("Publication year", 2010, 2021, (2010, 2021), 1)
|
47 |
-
# filter_citations = st.sidebar.slider("Citations", 0, 250, 0)
|
48 |
num_results = st.sidebar.slider("Number of search results", 10, 50, 10)
|
49 |
|
50 |
# Fetch results
|
51 |
if user_input:
|
52 |
# Get paper IDs
|
53 |
D, I = vector_search([user_input], model, faiss_index, num_results)
|
54 |
-
|
55 |
-
|
|
|
|
|
|
|
|
|
|
|
56 |
# Get individual results
|
57 |
i = 0
|
58 |
for id_ in I.flatten().tolist():
|
|
|
41 |
languages = ['English', 'Hindi', 'Bengali', 'Marathi', 'Telugu', 'Tamil', 'Gujarati', 'Kannada', 'Odia', 'Malayalam', 'Panjabi', 'Assamese']
|
42 |
|
43 |
# Multiselect for choosing languages
|
44 |
+
selected_languages = st.sidebar.multiselect('Select languages for search results', languages)
|
45 |
|
|
|
|
|
46 |
num_results = st.sidebar.slider("Number of search results", 10, 50, 10)
|
47 |
|
48 |
# Fetch results
|
49 |
if user_input:
|
50 |
# Get paper IDs
|
51 |
D, I = vector_search([user_input], model, faiss_index, num_results)
|
52 |
+
|
53 |
+
# Filter data by selected languages (if any)
|
54 |
+
if selected_languages:
|
55 |
+
frame = data[data['language'].isin(selected_languages)]
|
56 |
+
else:
|
57 |
+
frame = data
|
58 |
+
|
59 |
# Get individual results
|
60 |
i = 0
|
61 |
for id_ in I.flatten().tolist():
|