ale93111 commited on
Commit
874a388
·
1 Parent(s): 2d9884b
Files changed (1) hide show
  1. src/streamlit_app.py +13 -7
src/streamlit_app.py CHANGED
@@ -87,13 +87,19 @@ elif st.session_state.current_view == "search":
87
  query = st.text_input("Enter keywords (e.g., 'Diffusion Models', 'LLM')", key="global_search")
88
 
89
  if query:
90
- PAGE_SIZE = 10
91
- offset = st.session_state.page_number * PAGE_SIZE
92
-
93
- search_url = f"https://datasets-server.huggingface.co/search?dataset=pwc-archive/papers-with-abstracts&split=train&query={query}&offset={offset}&length={PAGE_SIZE}"
94
-
 
 
 
 
 
 
95
  with st.spinner("Searching..."):
96
- response = requests.get(search_url)
97
  if response.status_code == 200:
98
  data = response.json()
99
  papers = [item['row'] for item in data['rows']]
@@ -103,7 +109,7 @@ elif st.session_state.current_view == "search":
103
 
104
  for p in papers:
105
  with st.expander(p['title']):
106
- st.write(p['abstract'])
107
  if p.get('arxiv_id'):
108
  st.link_button("ArXiv", f"https://arxiv.org/abs/{p['arxiv_id']}")
109
  else:
 
87
  query = st.text_input("Enter keywords (e.g., 'Diffusion Models', 'LLM')", key="global_search")
88
 
89
  if query:
90
+ # Important: Added &config=default
91
+ search_url = "https://datasets-server.huggingface.co/search"
92
+ params = {
93
+ "dataset": "pwc-archive/papers-with-abstracts",
94
+ "config": "default", # <--- This fixes your error
95
+ "split": "train",
96
+ "query": query,
97
+ "offset": st.session_state.page_number * 10,
98
+ "length": 10
99
+ }
100
+
101
  with st.spinner("Searching..."):
102
+ response = requests.get(search_url, params=params)
103
  if response.status_code == 200:
104
  data = response.json()
105
  papers = [item['row'] for item in data['rows']]
 
109
 
110
  for p in papers:
111
  with st.expander(p['title']):
112
+ st.write(p['abstract'][:500] + "...")
113
  if p.get('arxiv_id'):
114
  st.link_button("ArXiv", f"https://arxiv.org/abs/{p['arxiv_id']}")
115
  else: