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