lynn-twinkl
commited on
Commit
·
3679914
1
Parent(s):
cb9c1ba
Added additional texts for ui
Browse files
app.py
CHANGED
|
@@ -25,7 +25,7 @@ from typing import Tuple
|
|
| 25 |
# changes. The function only re‑runs if the **file contents** change.
|
| 26 |
# -----------------------------------------------------------------------------
|
| 27 |
|
| 28 |
-
@st.cache_data(show_spinner=
|
| 29 |
def load_and_process(raw_csv: bytes) -> Tuple[pd.DataFrame, str]:
|
| 30 |
"""
|
| 31 |
Load CSV from raw bytes, detect freeform column, compute necessity scores,
|
|
@@ -58,7 +58,7 @@ def load_and_process(raw_csv: bytes) -> Tuple[pd.DataFrame, str]:
|
|
| 58 |
# -----------------------------------------------------------------------------
|
| 59 |
|
| 60 |
|
| 61 |
-
@st.cache_data(show_spinner=
|
| 62 |
def compute_shortlist(df: pd.DataFrame) -> pd.DataFrame:
|
| 63 |
"""Pre‑compute shortlist_score for all rows (used for both modes)."""
|
| 64 |
return shortlist_applications(df, k=len(df))
|
|
@@ -68,12 +68,13 @@ def compute_shortlist(df: pd.DataFrame) -> pd.DataFrame:
|
|
| 68 |
################################
|
| 69 |
|
| 70 |
style_metric_cards(box_shadow=False, border_left_color='#E7F4FF',background_color='#E7F4FF', border_size_px=0, border_radius_px=6)
|
|
|
|
| 71 |
st.title("Community Collections Helper")
|
| 72 |
|
| 73 |
uploaded_file = st.file_uploader("Upload grant applications file for analysis", type='csv')
|
| 74 |
|
| 75 |
if uploaded_file is not None:
|
| 76 |
-
# Read file from
|
| 77 |
raw = uploaded_file.read()
|
| 78 |
|
| 79 |
## ---- PROCESSED DATA (CACHED) ----
|
|
@@ -152,10 +153,14 @@ if uploaded_file is not None:
|
|
| 152 |
st.header("🌸 Manual Filtering")
|
| 153 |
st.markdown(
|
| 154 |
"""
|
| 155 |
-
|
| 156 |
-
|
|
|
|
| 157 |
"""
|
| 158 |
)
|
|
|
|
|
|
|
|
|
|
| 159 |
for idx, row in filtered_df.iterrows():
|
| 160 |
with st.expander(f"Application \#{idx}"):
|
| 161 |
st.write("")
|
|
|
|
| 25 |
# changes. The function only re‑runs if the **file contents** change.
|
| 26 |
# -----------------------------------------------------------------------------
|
| 27 |
|
| 28 |
+
@st.cache_data(show_spinner=True)
|
| 29 |
def load_and_process(raw_csv: bytes) -> Tuple[pd.DataFrame, str]:
|
| 30 |
"""
|
| 31 |
Load CSV from raw bytes, detect freeform column, compute necessity scores,
|
|
|
|
| 58 |
# -----------------------------------------------------------------------------
|
| 59 |
|
| 60 |
|
| 61 |
+
@st.cache_data(show_spinner=True)
|
| 62 |
def compute_shortlist(df: pd.DataFrame) -> pd.DataFrame:
|
| 63 |
"""Pre‑compute shortlist_score for all rows (used for both modes)."""
|
| 64 |
return shortlist_applications(df, k=len(df))
|
|
|
|
| 68 |
################################
|
| 69 |
|
| 70 |
style_metric_cards(box_shadow=False, border_left_color='#E7F4FF',background_color='#E7F4FF', border_size_px=0, border_radius_px=6)
|
| 71 |
+
|
| 72 |
st.title("Community Collections Helper")
|
| 73 |
|
| 74 |
uploaded_file = st.file_uploader("Upload grant applications file for analysis", type='csv')
|
| 75 |
|
| 76 |
if uploaded_file is not None:
|
| 77 |
+
# Read file from raw bytes for caching and repeated use --> this ensure all the processing isn't repeated when a user changes the filters
|
| 78 |
raw = uploaded_file.read()
|
| 79 |
|
| 80 |
## ---- PROCESSED DATA (CACHED) ----
|
|
|
|
| 153 |
st.header("🌸 Manual Filtering")
|
| 154 |
st.markdown(
|
| 155 |
"""
|
| 156 |
+
Below you'll find applications that **did not** make it into the shortlist for you to manually review or append to the shortlist if desired.
|
| 157 |
+
|
| 158 |
+
You may use the **side panel** filters to more easily sort through applications that you'd like to review.
|
| 159 |
"""
|
| 160 |
)
|
| 161 |
+
|
| 162 |
+
st.markdown("#### Filtered Applications")
|
| 163 |
+
st.write("")
|
| 164 |
for idx, row in filtered_df.iterrows():
|
| 165 |
with st.expander(f"Application \#{idx}"):
|
| 166 |
st.write("")
|