mgbam commited on
Commit
24069b7
·
verified ·
1 Parent(s): fc4c6fa

Create paper_list.py

Browse files
Files changed (1) hide show
  1. components/paper_list.py +27 -0
components/paper_list.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Paper list component
2
+ # File: components/paper_list.py
3
+ import streamlit as st
4
+
5
+
6
+ def render_paper_list(papers):
7
+ """
8
+ Display a list of papers: title, authors, truncated abstract, and link if available.
9
+ """
10
+ st.header("📄 Papers Found")
11
+ if not papers:
12
+ st.warning("No papers found. Try another query.")
13
+ return
14
+
15
+ for paper in papers:
16
+ title = paper.get("title", "Untitled")
17
+ authors = paper.get("authors", [])
18
+ abstract = paper.get("abstract", "No abstract.")
19
+ link = paper.get("url")
20
+
21
+ with st.expander(title, expanded=False):
22
+ st.markdown(f"**Authors:** {', '.join(authors)}")
23
+ # Truncate abstract to 300 chars
24
+ snippet = abstract if len(abstract) < 300 else abstract[:300] + "..."
25
+ st.write(snippet)
26
+ if link:
27
+ st.markdown(f"[Read more]({link})")