Spaces:
Sleeping
Sleeping
Update components/sidebar.py
Browse files- components/sidebar.py +24 -16
components/sidebar.py
CHANGED
|
@@ -2,39 +2,47 @@ import streamlit as st
|
|
| 2 |
|
| 3 |
def render_sidebar():
|
| 4 |
"""
|
| 5 |
-
|
| 6 |
|
| 7 |
Returns:
|
| 8 |
-
query (str): The user's
|
| 9 |
-
num_results (int):
|
| 10 |
-
theme (str):
|
| 11 |
-
search_clicked (bool):
|
|
|
|
| 12 |
"""
|
| 13 |
-
st.sidebar.title("
|
| 14 |
|
| 15 |
-
#
|
| 16 |
query = st.sidebar.text_input(
|
| 17 |
label="Enter your research topic:",
|
| 18 |
value="",
|
| 19 |
placeholder="e.g. CRISPR delivery"
|
| 20 |
)
|
| 21 |
|
| 22 |
-
#
|
| 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
|
| 31 |
theme = st.sidebar.selectbox(
|
| 32 |
-
label="Theme
|
| 33 |
-
options=["Light", "Dark"],
|
| 34 |
index=0
|
| 35 |
)
|
| 36 |
|
| 37 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
search_clicked = st.sidebar.button("Search")
|
| 39 |
|
| 40 |
-
return query, num_results, theme, search_clicked
|
|
|
|
| 2 |
|
| 3 |
def render_sidebar():
|
| 4 |
"""
|
| 5 |
+
Sidebar with all controls for the research companion app.
|
| 6 |
|
| 7 |
Returns:
|
| 8 |
+
- query (str): The user's main research query.
|
| 9 |
+
- num_results (int): Max number of papers to show.
|
| 10 |
+
- theme (str): 'Light' or 'Dark'.
|
| 11 |
+
- search_clicked (bool): Did user click Search?
|
| 12 |
+
- gemini_prompt (str): Optional Gemini Q&A question.
|
| 13 |
"""
|
| 14 |
+
st.sidebar.title("🚀 MCP Research Companion")
|
| 15 |
|
| 16 |
+
# Main research topic input
|
| 17 |
query = st.sidebar.text_input(
|
| 18 |
label="Enter your research topic:",
|
| 19 |
value="",
|
| 20 |
placeholder="e.g. CRISPR delivery"
|
| 21 |
)
|
| 22 |
|
| 23 |
+
# Number of results slider
|
| 24 |
num_results = st.sidebar.slider(
|
| 25 |
+
label="Max papers to display",
|
| 26 |
+
min_value=1,
|
| 27 |
+
max_value=20,
|
| 28 |
value=5
|
| 29 |
)
|
| 30 |
|
| 31 |
+
# Theme toggle
|
| 32 |
theme = st.sidebar.selectbox(
|
| 33 |
+
label="Theme",
|
| 34 |
+
options=["Light", "Dark"],
|
| 35 |
index=0
|
| 36 |
)
|
| 37 |
|
| 38 |
+
# Gemini question input (for Q&A at any time)
|
| 39 |
+
gemini_prompt = st.sidebar.text_input(
|
| 40 |
+
label="💡 Ask Gemini (about anything!):",
|
| 41 |
+
value="",
|
| 42 |
+
placeholder="e.g. Summarize the latest CRISPR techniques"
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
# Search button
|
| 46 |
search_clicked = st.sidebar.button("Search")
|
| 47 |
|
| 48 |
+
return query, num_results, theme, search_clicked, gemini_prompt
|