Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -121,13 +121,13 @@ def display_sample_query_boxes(key_prefix=""):
|
|
| 121 |
}
|
| 122 |
|
| 123 |
cols = st.columns(len(sample_queries))
|
| 124 |
-
title_h, desc_h, query_h = "30px", "
|
| 125 |
|
| 126 |
for idx, (key, details) in enumerate(sample_queries.items()):
|
| 127 |
with cols[idx]:
|
| 128 |
st.markdown(f"""
|
| 129 |
<div style="
|
| 130 |
-
width:100%; height:
|
| 131 |
border-radius:10px; padding:15px; margin:auto;
|
| 132 |
display:flex; flex-direction:column; justify-content:space-between;
|
| 133 |
box-shadow:2px 2px 8px rgba(0,0,0,0.1);
|
|
@@ -148,7 +148,7 @@ def display_sample_query_boxes(key_prefix=""):
|
|
| 148 |
|
| 149 |
# center the button directly under the box
|
| 150 |
st.markdown("<div style='text-align:center; margin-top:10px;'>", unsafe_allow_html=True)
|
| 151 |
-
if st.button("
|
| 152 |
page_map = {
|
| 153 |
"search_etf": "ETF Search",
|
| 154 |
"comparison": "ETF Comparison",
|
|
@@ -172,7 +172,7 @@ def process_query(task: str, query: str):
|
|
| 172 |
with st.spinner("Searching ETFs..."):
|
| 173 |
fetched = semantic_search(query, top_k)
|
| 174 |
df_out = modules.get_etf_recommendations_from_list(
|
| 175 |
-
fetched,
|
| 176 |
)
|
| 177 |
msg = f"{len(df_out)} ETFs found."
|
| 178 |
st.session_state[f"all_chat_history_{task}"].append(
|
|
@@ -186,8 +186,7 @@ def process_query(task: str, query: str):
|
|
| 186 |
resp, fig, df_out = "Please specify exactly two tickers.", None, None
|
| 187 |
else:
|
| 188 |
df_out = modules.get_etf_recommendations_from_list(
|
| 189 |
-
|
| 190 |
-
modules.get_cols_to_display(), df_etf, top_n=2
|
| 191 |
)
|
| 192 |
fig = modules.compare_etfs_interactive(*tk)
|
| 193 |
resp = f"Compared {tk[0]} vs. {tk[1]}."
|
|
|
|
| 121 |
}
|
| 122 |
|
| 123 |
cols = st.columns(len(sample_queries))
|
| 124 |
+
title_h, desc_h, query_h = "30px", "40px", "50px"
|
| 125 |
|
| 126 |
for idx, (key, details) in enumerate(sample_queries.items()):
|
| 127 |
with cols[idx]:
|
| 128 |
st.markdown(f"""
|
| 129 |
<div style="
|
| 130 |
+
width:100%; height:250; border:1px solid #ddd;
|
| 131 |
border-radius:10px; padding:15px; margin:auto;
|
| 132 |
display:flex; flex-direction:column; justify-content:space-between;
|
| 133 |
box-shadow:2px 2px 8px rgba(0,0,0,0.1);
|
|
|
|
| 148 |
|
| 149 |
# center the button directly under the box
|
| 150 |
st.markdown("<div style='text-align:center; margin-top:10px;'>", unsafe_allow_html=True)
|
| 151 |
+
if st.button("Go to the app", key=key_prefix+key):
|
| 152 |
page_map = {
|
| 153 |
"search_etf": "ETF Search",
|
| 154 |
"comparison": "ETF Comparison",
|
|
|
|
| 172 |
with st.spinner("Searching ETFs..."):
|
| 173 |
fetched = semantic_search(query, top_k)
|
| 174 |
df_out = modules.get_etf_recommendations_from_list(
|
| 175 |
+
fetched, df_etf, top_n
|
| 176 |
)
|
| 177 |
msg = f"{len(df_out)} ETFs found."
|
| 178 |
st.session_state[f"all_chat_history_{task}"].append(
|
|
|
|
| 186 |
resp, fig, df_out = "Please specify exactly two tickers.", None, None
|
| 187 |
else:
|
| 188 |
df_out = modules.get_etf_recommendations_from_list(
|
| 189 |
+
tk, df_etf, top_n=2
|
|
|
|
| 190 |
)
|
| 191 |
fig = modules.compare_etfs_interactive(*tk)
|
| 192 |
resp = f"Compared {tk[0]} vs. {tk[1]}."
|