yutohub commited on
Commit
3e2bddf
β€’
1 Parent(s): 2f7da08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -12
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
- if st.button('β†’'):
55
- results = retriever.invoke(user_query)
56
- st.text(f"Top n {len(results)} related papers")
57
-
58
- for result in results:
59
- with st.expander(label=result.metadata['title'], expanded=False):
60
- for k in result.metadata:
61
- st.write(f"{k}: {result.metadata[k]}")
62
- st.divider()
63
- st.markdown(result.page_content)
 
 
 
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)