gaspar-avit commited on
Commit
1215884
1 Parent(s): 5ee4e8b

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -198,17 +198,20 @@ def generate_prediction(input_data):
198
 
199
  -return: predicted probability of having a cardiovascular disease
200
  """
201
- # prediction = MODEL.predict(input_data)
202
- proba = MODEL.predict_proba(input_data)
203
- positive_proba = round(proba[0,1]*100)
204
 
205
- st.title('Predicted cardiovascular disease probability:')
 
 
 
206
  st.markdown(f"<h1 style='text-align: center; color: grey;'>\
207
  {positive_proba} %</h1>",
208
  unsafe_allow_html=True)
209
  st.progress(positive_proba)
210
 
211
- return proba
212
 
213
 
214
  ###############################
@@ -252,8 +255,7 @@ if __name__ == "__main__":
252
 
253
  # Generate prediction
254
  if IS_CLICKED:
255
- st.write('Work in progress!')
256
- prediction = generate_prediction(session.input_data)
257
 
258
  st.text("")
259
  st.text("")
 
198
 
199
  -return: predicted probability of having a cardiovascular disease
200
  """
201
+ # Compute probability
202
+ probs = MODEL.predict_proba(input_data)
203
+ positive_proba = round(probs[0,1]*100)
204
 
205
+ # Show results
206
+ st.markdown("<h2 style='text-align: center; color: black;'>\
207
+ Predicted cardiovascular disease probability:</h2>",
208
+ unsafe_allow_html=True)
209
  st.markdown(f"<h1 style='text-align: center; color: grey;'>\
210
  {positive_proba} %</h1>",
211
  unsafe_allow_html=True)
212
  st.progress(positive_proba)
213
 
214
+ return probs
215
 
216
 
217
  ###############################
 
255
 
256
  # Generate prediction
257
  if IS_CLICKED:
258
+ predicted_probs = generate_prediction(session.input_data)
 
259
 
260
  st.text("")
261
  st.text("")