lynn-twinkl commited on
Commit
78c2168
·
1 Parent(s): 164201a

Usage to pills

Browse files
Files changed (1) hide show
  1. app.py +14 -13
app.py CHANGED
@@ -38,7 +38,7 @@ def load_and_process(raw_csv: bytes) -> typing.Tuple[pd.DataFrame, str]:
38
  # APP SCRIPT
39
  ################################
40
 
41
- st.title("Grant Applications Helper")
42
 
43
  uploaded_file = st.file_uploader("Upload grant applications file for analysis", type='csv')
44
 
@@ -46,15 +46,10 @@ if uploaded_file is not None:
46
  # Read raw bytes for caching and repeated use --> this ensure all the processing isn't repeated when a user changes the filters
47
  raw = uploaded_file.read()
48
 
49
- st.markdown("""
50
- ### Data Preview
51
- Here's the data you uploaded!
52
- """
53
- )
54
- df_orig = pd.read_csv(BytesIO(raw))
55
- st.dataframe(df_orig)
56
-
57
- st.divider()
58
 
59
  ## ---- PROCESSED DATA (CACHED) ----
60
 
@@ -77,7 +72,7 @@ if uploaded_file is not None:
77
  ## ---- NECESSITY INDEX CHART ----
78
 
79
  st.header("Processed Applications")
80
- st.subheader("Necessity Index Distribution")
81
 
82
  with st.expander("Learn about our indexing algorithm", icon='🌱'):
83
  st.markdown(
@@ -112,7 +107,8 @@ if uploaded_file is not None:
112
  st.bar_chart(df['necessity_index'])
113
 
114
  # Review applications
115
- st.subheader("Applications")
 
116
  for idx, row in filtered_df.iterrows():
117
  with st.expander(f"Application \#{idx} | Necessity: {row['necessity_index']:.1f}"):
118
  col1, col2 = st.columns((1, 3))
@@ -126,7 +122,12 @@ if uploaded_file is not None:
126
  col2.write(row[freeform_col])
127
  if usage_items:
128
  col2.markdown("**EXTRACTED USAGE ITEMS:**")
129
- col2.write(", ".join(usage_items))
 
 
 
 
 
130
  else:
131
  col2.markdown("*No specific usage items extracted.*")
132
  # Shortlist checkbox
 
38
  # APP SCRIPT
39
  ################################
40
 
41
+ st.title("Community Collections Helper")
42
 
43
  uploaded_file = st.file_uploader("Upload grant applications file for analysis", type='csv')
44
 
 
46
  # Read raw bytes for caching and repeated use --> this ensure all the processing isn't repeated when a user changes the filters
47
  raw = uploaded_file.read()
48
 
49
+ with st.expander("Data Preview", icon='📊'):
50
+ st.markdown("Here's the data you uploaded")
51
+ df_orig = pd.read_csv(BytesIO(raw))
52
+ st.dataframe(df_orig)
 
 
 
 
 
53
 
54
  ## ---- PROCESSED DATA (CACHED) ----
55
 
 
72
  ## ---- NECESSITY INDEX CHART ----
73
 
74
  st.header("Processed Applications")
75
+ st.markdown("#### Necessity Index Distribution")
76
 
77
  with st.expander("Learn about our indexing algorithm", icon='🌱'):
78
  st.markdown(
 
107
  st.bar_chart(df['necessity_index'])
108
 
109
  # Review applications
110
+ st.subheader("Filtered Applications")
111
+ st.markdown("To filter applications, use the app's side panel on the left-hand side.")
112
  for idx, row in filtered_df.iterrows():
113
  with st.expander(f"Application \#{idx} | Necessity: {row['necessity_index']:.1f}"):
114
  col1, col2 = st.columns((1, 3))
 
122
  col2.write(row[freeform_col])
123
  if usage_items:
124
  col2.markdown("**EXTRACTED USAGE ITEMS:**")
125
+ # Display usage items as colored pills
126
+ pills_html = "".join(
127
+ f"<span style='display:inline-block;background-color:#D7E0FB;color:#3C63C9;border-radius:20px;padding:4px 10px;margin:2px;'>{item}</span>"
128
+ for item in usage_items
129
+ )
130
+ col2.markdown(pills_html, unsafe_allow_html=True)
131
  else:
132
  col2.markdown("*No specific usage items extracted.*")
133
  # Shortlist checkbox