Spaces:
Running
Running
added expander
Browse files
app.py
CHANGED
@@ -152,20 +152,20 @@ def retriever(query: str, selected_retriever: str):
|
|
152 |
st.session_state.last_expander_id += 1
|
153 |
return f"expander_{st.session_state.last_expander_id}"
|
154 |
|
|
|
|
|
155 |
for idx, document in enumerate(topk_documents):
|
156 |
try:
|
157 |
a_idx = document.lower().index("abstract:")
|
158 |
title = document[:a_idx].replace('\n', ' ')
|
159 |
doc_details = document[a_idx:]
|
160 |
-
except:
|
161 |
-
print(f"Document parsing error for title and other contents-\n{document}")
|
162 |
title = "Document title"
|
163 |
doc_details = document
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
except:
|
168 |
-
print(f"Error in expander {idx} logic")
|
169 |
|
170 |
# retrieved_document_titles = ""
|
171 |
# for document in topk_documents:
|
|
|
152 |
st.session_state.last_expander_id += 1
|
153 |
return f"expander_{st.session_state.last_expander_id}"
|
154 |
|
155 |
+
print(f"Topk documents: {topk_documents}")
|
156 |
+
|
157 |
for idx, document in enumerate(topk_documents):
|
158 |
try:
|
159 |
a_idx = document.lower().index("abstract:")
|
160 |
title = document[:a_idx].replace('\n', ' ')
|
161 |
doc_details = document[a_idx:]
|
162 |
+
except Exception as e:
|
163 |
+
print(f"Document parsing error for title and other contents-\n{document}, \n\nError: {e}")
|
164 |
title = "Document title"
|
165 |
doc_details = document
|
166 |
+
|
167 |
+
with st.expander(f"Rank {idx+1} - {title.replace("Title:", "")}"):
|
168 |
+
st.write(doc_details)
|
|
|
|
|
169 |
|
170 |
# retrieved_document_titles = ""
|
171 |
# for document in topk_documents:
|