mgbam commited on
Commit
c08b7b9
Β·
verified Β·
1 Parent(s): 6b6deea

Create sidebar.py

Browse files
Files changed (1) hide show
  1. components/sidebar.py +36 -0
components/sidebar.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Sidebar component
2
+ # File: components/sidebar.py
3
+ import streamlit as st
4
+
5
+
6
+ def render_sidebar():
7
+ """
8
+ Display the sidebar UI for user query input.
9
+ Returns:
10
+ query (str): The research query text.
11
+ search_clicked (bool): Whether the search button was clicked.
12
+ """
13
+ st.sidebar.header("πŸ” Research Query")
14
+ query = st.sidebar.text_input("Enter your research topic:", "")
15
+ search_clicked = st.sidebar.button("Search")
16
+ return query, search_clicked
17
+
18
+
19
+ # File: components/paper_list.py
20
+ import streamlit as st
21
+
22
+
23
+ def render_paper_list(papers):
24
+ """
25
+ Display a list of papers with titles, authors, and abstracts.
26
+ Args:
27
+ papers (List[dict]): Each dict should have 'id', 'title', 'authors', 'abstract'.
28
+ """
29
+ st.header("πŸ“„ Papers Found")
30
+ if not papers:
31
+ st.info("No papers found for this query.")
32
+ return
33
+ for paper in papers:
34
+ with st.expander(paper.get("title", "Unknown Title")):
35
+ st.markdown(f"**Authors:** {', '.join(paper.get('authors', []))}")
36
+ st.write(paper.get("abstract", "No abstract available."))