Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -43,21 +43,23 @@ st.title("HF Daily Papers Search")
|
|
43 |
st.markdown(f"Search papers from [HF daily papers](https://huggingface.co/papers).")
|
44 |
st.markdown(f"Nmber of documents: `{len(docs)}`.")
|
45 |
st.markdown(f"From `{oldest_date.strftime('%Y-%m-%d')}` to `{newest_date.strftime('%Y-%m-%d')}`.")
|
46 |
-
st.markdown("This app uses BM25, allowing you to search not only with keywords like \"machine learning\" but also with documents like \"How to generate synthetic data using LLM.\"")
|
47 |
|
48 |
col1, col2 = st.columns([4, 1])
|
49 |
|
50 |
with col1:
|
51 |
-
user_query = st.text_input("Search anything...")
|
52 |
|
53 |
with col2:
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
st.
|
|
|
|
|
|
43 |
st.markdown(f"Search papers from [HF daily papers](https://huggingface.co/papers).")
|
44 |
st.markdown(f"Nmber of documents: `{len(docs)}`.")
|
45 |
st.markdown(f"From `{oldest_date.strftime('%Y-%m-%d')}` to `{newest_date.strftime('%Y-%m-%d')}`.")
|
46 |
+
st.markdown("This app uses [BM25](https://en.wikipedia.org/wiki/Okapi_BM25), allowing you to search not only with keywords like \"machine learning\" \n but also with documents like \"How to generate synthetic data using LLM.\"")
|
47 |
|
48 |
col1, col2 = st.columns([4, 1])
|
49 |
|
50 |
with col1:
|
51 |
+
user_query = st.text_input("", placeholder="Search anything...")
|
52 |
|
53 |
with col2:
|
54 |
+
search_button = st.button('β')
|
55 |
+
|
56 |
+
if search_button:
|
57 |
+
results = retriever.invoke(user_query)
|
58 |
+
st.text(f"Top n {len(results)} related papers")
|
59 |
+
|
60 |
+
for result in results:
|
61 |
+
with st.expander(label=result.metadata['title'], expanded=False):
|
62 |
+
for k in result.metadata:
|
63 |
+
st.write(f"{k}: {result.metadata[k]}")
|
64 |
+
st.divider()
|
65 |
+
st.markdown(result.page_content)
|