nishantguvvada commited on
Commit
c514415
·
verified ·
1 Parent(s): 66d520c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -31,8 +31,14 @@ weight = st.number_input('Input your weight!', max_value=140.0, min_value=35.0,
31
  heart_rate = st.number_input('Input your heart rate!', max_value=130.0, min_value=60.0, step=20.0)
32
  body_temp = st.number_input('Input your body temperature!', max_value=45.0, min_value=35.0, step=1.0)
33
 
34
- def model_prediction(age, height, weight, duration, heart_rate, body_temp, gender, model):
35
  with st.spinner('Model is being loaded..'):
 
 
 
 
 
 
36
  inputs = pd.DataFrame([{'Gender': gender, 'Age': age, 'Height': height, 'Weight': weight, 'Duration': duration, 'Heart_Rate': heart_rate, 'Body_Temp': body_temp}])
37
  predictions = model.predict(inputs)
38
  st.write("""# Prediction : """ , predictions)
@@ -50,13 +56,8 @@ with st.sidebar:
50
  gender = 1
51
 
52
  model_input = st.radio("model", ["Random Forest Regressor", "Linear Regressor", "XG Boost"], index=None)
53
- if model_input == "Random Forest Regressor":
54
- model = load_rfr()
55
- elif model_input == "Linear Regressor":
56
- model = load_lr()
57
- else:
58
- model_input == load_xgb()
59
 
60
  with st.container():
61
  if st.button("Calculate"):
62
- model_prediction(age, height, weight, duration, heart_rate, body_temp, gender, model)
 
31
  heart_rate = st.number_input('Input your heart rate!', max_value=130.0, min_value=60.0, step=20.0)
32
  body_temp = st.number_input('Input your body temperature!', max_value=45.0, min_value=35.0, step=1.0)
33
 
34
+ def model_prediction(age, height, weight, duration, heart_rate, body_temp, gender, model_input):
35
  with st.spinner('Model is being loaded..'):
36
+ if model_input == "Random Forest Regressor":
37
+ model = load_rfr()
38
+ elif model_input == "Linear Regressor":
39
+ model = load_lr()
40
+ else:
41
+ model == load_xgb()
42
  inputs = pd.DataFrame([{'Gender': gender, 'Age': age, 'Height': height, 'Weight': weight, 'Duration': duration, 'Heart_Rate': heart_rate, 'Body_Temp': body_temp}])
43
  predictions = model.predict(inputs)
44
  st.write("""# Prediction : """ , predictions)
 
56
  gender = 1
57
 
58
  model_input = st.radio("model", ["Random Forest Regressor", "Linear Regressor", "XG Boost"], index=None)
59
+
 
 
 
 
 
60
 
61
  with st.container():
62
  if st.button("Calculate"):
63
+ model_prediction(age, height, weight, duration, heart_rate, body_temp, gender, model_input)