Spaces:
Running
Running
# Paper list component | |
# File: components/paper_list.py | |
import streamlit as st | |
def render_paper_list(papers): | |
""" | |
Display a list of papers: title, authors, truncated abstract, and link if available. | |
""" | |
st.header("π Papers Found") | |
if not papers: | |
st.warning("No papers found. Try another query.") | |
return | |
for paper in papers: | |
title = paper.get("title", "Untitled") | |
authors = paper.get("authors", []) | |
abstract = paper.get("abstract", "No abstract.") | |
link = paper.get("url") | |
with st.expander(title, expanded=False): | |
st.markdown(f"**Authors:** {', '.join(authors)}") | |
# Truncate abstract to 300 chars | |
snippet = abstract if len(abstract) < 300 else abstract[:300] + "..." | |
st.write(snippet) | |
if link: | |
st.markdown(f"[Read more]({link})") |