ivcvy commited on
Commit
296ba73
·
verified ·
1 Parent(s): b0f8552

update colors

Browse files
Files changed (1) hide show
  1. app.py +28 -9
app.py CHANGED
@@ -99,6 +99,7 @@ if not st.session_state.filtered_df.empty:
99
  st.session_state.events = [
100
  {
101
  "title": row["DESCRIPTION"],
 
102
  "start": row["START"].strftime("%Y-%m-%d"),
103
  "end": row["START"].strftime("%Y-%m-%d"),
104
  }
@@ -166,10 +167,10 @@ with st.sidebar:
166
  background-color: #45a049;
167
  }
168
  .fc-button-primary {
169
- background-color: #008CBA;
170
  }
171
  .fc-button-primary:hover {
172
- background-color: #007bb5;
173
  }
174
  .fc-button-secondary {
175
  background-color: #e7e7e7;
@@ -190,10 +191,28 @@ if st.session_state.state.get("eventsSet") is not None:
190
  col1, col2 = st.columns([1, 2])
191
 
192
  with col1:
193
- # training on lung data
194
- # add slider to select number of clusters
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  st.session_state.n_clusters = st.slider("Select number of clusters", 2, 5, 5)
196
- if st.button("Train model"):
197
  df = df[["ID", "START", "STOP", "DESCRIPTION"]]
198
  st.session_state.df = df.groupby("ID").agg({"DESCRIPTION": list}).reset_index()
199
  st.session_state.df["DESCRIPTION"] = st.session_state.df["DESCRIPTION"].apply(
@@ -221,13 +240,13 @@ with col1:
221
  st.session_state.cluster_labels = st.session_state.kmeans.fit_predict(
222
  padded_data_array
223
  )
224
- st.write("Model trained successfully!")
225
- # clustering
226
- if st.button("Show cluster"):
227
  st.session_state.idx = st.session_state.df.index[
228
  st.session_state.df["ID"] == st.session_state.id
229
  ]
230
- st.write("Cluster:", st.session_state.cluster_labels[st.session_state.idx])
 
 
 
231
 
232
  try:
233
  st.session_state.label_counts = (
 
99
  st.session_state.events = [
100
  {
101
  "title": row["DESCRIPTION"],
102
+ "color": "#3a6ad6",
103
  "start": row["START"].strftime("%Y-%m-%d"),
104
  "end": row["START"].strftime("%Y-%m-%d"),
105
  }
 
167
  background-color: #45a049;
168
  }
169
  .fc-button-primary {
170
+ background-color: #3a6ad6;
171
  }
172
  .fc-button-primary:hover {
173
+ background-color: #3a6ad6;
174
  }
175
  .fc-button-secondary {
176
  background-color: #e7e7e7;
 
191
  col1, col2 = st.columns([1, 2])
192
 
193
  with col1:
194
+ # clustering
195
+ st.markdown(
196
+ """
197
+ <style>
198
+ div.stSlider > div[data-baseweb="slider"] > div > div > div[role="slider"] {
199
+ background-color: #3a6ad6;
200
+ box-shadow: rgba(58, 106, 214, 0.2) 0px 0px 0px 0.2rem;
201
+ }
202
+ div.stSlider > div[data-baseweb="slider"] > div > div > div > div {
203
+ color: #3a6ad6;
204
+ }
205
+ div.stSlider > div[data-baseweb = "slider"] > div > div {{
206
+ background: linear-gradient(to right, #3a6ad6 0%,
207
+ #3a6ad6 {NB}%,
208
+ #3a6ad6 {NB}%,
209
+ #3a6ad6 100%); }}
210
+ </style>
211
+ """,
212
+ unsafe_allow_html=True,
213
+ )
214
  st.session_state.n_clusters = st.slider("Select number of clusters", 2, 5, 5)
215
+ if st.button("Show cluster"):
216
  df = df[["ID", "START", "STOP", "DESCRIPTION"]]
217
  st.session_state.df = df.groupby("ID").agg({"DESCRIPTION": list}).reset_index()
218
  st.session_state.df["DESCRIPTION"] = st.session_state.df["DESCRIPTION"].apply(
 
240
  st.session_state.cluster_labels = st.session_state.kmeans.fit_predict(
241
  padded_data_array
242
  )
 
 
 
243
  st.session_state.idx = st.session_state.df.index[
244
  st.session_state.df["ID"] == st.session_state.id
245
  ]
246
+ st.write(
247
+ "This patient belonngs to cluster:",
248
+ st.session_state.cluster_labels[st.session_state.idx][0],
249
+ )
250
 
251
  try:
252
  st.session_state.label_counts = (