yutohub commited on
Commit
2f7da08
β€’
1 Parent(s): 9aba82f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -13
app.py CHANGED
@@ -40,16 +40,24 @@ newest_date = max(dates)
40
 
41
  # streamlit
42
  st.title("HF Daily Papers Search")
43
- st.markdown(f"Search papers from [HF daily papers](https://huggingface.co/papers).\n\nNmber of documents: {len(docs)}\n\nfrom {oldest_date.strftime('%Y-%m-%d')} to {newest_date.strftime('%Y-%m-%d')}")
44
-
45
- user_query = st.text_input("Search anything...")
46
- if st.button('β†’'):
47
- results = retriever.invoke(user_query)
48
- st.text(f"hit {len(results)} papers")
49
-
50
- for result in results:
51
- with st.expander(label=result.metadata['title'], expanded=False):
52
- for k in result.metadata:
53
- st.write(f"{k}: {result.metadata[k]}")
54
- st.divider()
55
- st.markdown(result.page_content)
 
 
 
 
 
 
 
 
 
40
 
41
  # streamlit
42
  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)