mgbam commited on
Commit
0f01ba2
Β·
verified Β·
1 Parent(s): d9b98b5

Update components/sidebar.py

Browse files
Files changed (1) hide show
  1. components/sidebar.py +37 -31
components/sidebar.py CHANGED
@@ -1,36 +1,42 @@
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."))
 
1
+ #components/sidebar.py
 
 
2
 
3
+ import streamlit as st
4
 
5
  def render_sidebar():
6
+ """
7
+ Render the sidebar controls for the research companion app.
8
+
9
+ Returns:
10
+ query (str): The user's search query.
11
+ num_results (int): Maximum number of papers to display.
12
+ theme (str): UI theme selection ('Light' or 'Dark').
13
+ search_clicked (bool): True if the Search button was pressed.
14
+ """
15
+ st.sidebar.title("πŸ” Research Companion")
16
+
17
+ # Input for research topic
18
+ query = st.sidebar.text_input(
19
+ label="Enter your research topic:",
20
+ value="",
21
+ placeholder="e.g. CRISPR delivery"
22
+ )
23
+
24
+ # Slider for number of results
25
+ num_results = st.sidebar.slider(
26
+ label="Max papers to display",
27
+ min_value=1,
28
+ max_value=20,
29
+ value=5
30
+ )
31
+
32
+ # Theme selection
33
+ theme = st.sidebar.selectbox(
34
+ label="Theme:",
35
+ options=["Light", "Dark"],
36
+ index=0
37
+ )
38
 
39
+ # Search action
40
+ search_clicked = st.sidebar.button("Search")
41
 
42
+ return query, num_results, theme, search_clicked