AleksanderObuchowski commited on
Commit
c6b60db
1 Parent(s): 70c93c5

fixed a bug :)

Browse files
Files changed (1) hide show
  1. app.py +78 -80
app.py CHANGED
@@ -213,85 +213,83 @@ if open_modal:
213
  print(f"dupa : {[value for value in det_input.values()]}")
214
  if all(type(value) == str or value == 0 for value in det_input.values()):
215
  st.error("No input detected. Please fill in the form and try again.")
216
- # else:
217
- # results_modal.open()
218
- # if results_modal.is_open():
219
- covid = predict_det(**det_input)
220
-
221
- with results_container.container():
222
- st.markdown("### Results: ")
223
- options = {
224
- "title": {},
225
- # "tooltip": {
226
- # "trigger": "item",
227
- # "formatter": " Probabirity of the patients CBC results being {b} is {d}%",
228
- # },
229
- # "legend": {
230
- # "orient": "vertical",
231
- # "left": "left",
232
- # },
233
- "series": [
234
- {
235
- # "name": "访问来源",
236
- "type": "pie",
237
- "radius": "80%",
238
- "animation": True,
239
- "animationEasing": "cubicOut",
240
- "animationDuration": 10000,
241
- "label": {
242
- "position": "inner",
243
- "fontSize": 14,
244
- "formatter": "{b} {d}%",
245
- },
246
- "data": [
247
- {
248
- "value": round(covid, 2) * 100,
249
- "name": "Covid",
250
- "itemStyle": {"color": "#EE6766"},
251
  },
252
- {
253
- "value": round(1 - covid, 2) * 100,
254
- "name": "Normal",
255
- "itemStyle": {"color": "#91CC75"},
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
  },
257
- ],
258
- "emphasis": {
259
- "itemStyle": {
260
- "shadowBlur": 10,
261
- "shadowOffsetX": 0,
262
- "shadowColor": "rgba(0, 0, 0, 0.5)",
263
- }
264
- },
265
- }
266
- ],
267
- }
268
- st_echarts(
269
- options=options,
270
- height="300px",
271
- )
272
-
273
-
274
- # col1.button("PREDICT", on_click=predict_det, kwargs=det_input)
275
-
276
-
277
- # elif menu_id == 'Prognosis':
278
- # _, col1, col2, _ = st.columns(4)
279
- # col1.title('SARS-CoV-2 detection')
280
- # col1.text('Press predict after filling in the form below.')
281
- # col2.markdown("#")
282
- # col2.markdown("#")
283
- # col2.write("##")
284
- # col2.write("##")
285
-
286
- # for col in prog_cols1:
287
- # prog_input[col] = col1.number_input(col)
288
- # col2.text("")
289
-
290
- # for col in cat_cols:
291
- # prog_input[col] = col1.selectbox(col, ('F', 'M'))
292
- # col2.text("")
293
-
294
- # col2.write("##")
295
- # col2.write("##")
296
-
297
- # col1.button("PREDICT", on_click=predict_prog, kwargs=prog_input)
 
213
  print(f"dupa : {[value for value in det_input.values()]}")
214
  if all(type(value) == str or value == 0 for value in det_input.values()):
215
  st.error("No input detected. Please fill in the form and try again.")
216
+ else:
217
+ # results_modal.open()
218
+ # if results_modal.is_open():
219
+ covid = predict_det(**det_input)
220
+
221
+ with results_container.container():
222
+ st.markdown("### Results: ")
223
+ options = {
224
+ "title": {},
225
+ # "tooltip": {
226
+ # "trigger": "item",
227
+ # "formatter": " Probabirity of the patients CBC results being {b} is {d}%",
228
+ # },
229
+ # "legend": {
230
+ # "orient": "vertical",
231
+ # "left": "left",
232
+ # },
233
+ "series": [
234
+ {
235
+ # "name": "访问来源",
236
+ "type": "pie",
237
+ "radius": "80%",
238
+ "animation": True,
239
+ "animationEasing": "cubicOut",
240
+ "animationDuration": 10000,
241
+ "label": {
242
+ "position": "inner",
243
+ "fontSize": 14,
244
+ "formatter": "{b} {d}%",
 
 
 
 
 
 
245
  },
246
+ "data": [
247
+ {
248
+ "value": round(covid, 2) * 100,
249
+ "name": "Covid",
250
+ "itemStyle": {"color": "#EE6766"},
251
+ },
252
+ {
253
+ "value": round(1 - covid, 2) * 100,
254
+ "name": "Normal",
255
+ "itemStyle": {"color": "#91CC75"},
256
+ },
257
+ ],
258
+ "emphasis": {
259
+ "itemStyle": {
260
+ "shadowBlur": 10,
261
+ "shadowOffsetX": 0,
262
+ "shadowColor": "rgba(0, 0, 0, 0.5)",
263
+ }
264
  },
265
+ }
266
+ ],
267
+ }
268
+ st_echarts(
269
+ options=options,
270
+ height="300px",
271
+ )
272
+
273
+ # col1.button("PREDICT", on_click=predict_det, kwargs=det_input)
274
+
275
+ # elif menu_id == 'Prognosis':
276
+ # _, col1, col2, _ = st.columns(4)
277
+ # col1.title('SARS-CoV-2 detection')
278
+ # col1.text('Press predict after filling in the form below.')
279
+ # col2.markdown("#")
280
+ # col2.markdown("#")
281
+ # col2.write("##")
282
+ # col2.write("##")
283
+
284
+ # for col in prog_cols1:
285
+ # prog_input[col] = col1.number_input(col)
286
+ # col2.text("")
287
+
288
+ # for col in cat_cols:
289
+ # prog_input[col] = col1.selectbox(col, ('F', 'M'))
290
+ # col2.text("")
291
+
292
+ # col2.write("##")
293
+ # col2.write("##")
294
+
295
+ # col1.button("PREDICT", on_click=predict_prog, kwargs=prog_input)