Gagan0141 commited on
Commit
aa2dc1a
·
verified ·
1 Parent(s): ba0928e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -27
app.py CHANGED
@@ -23,8 +23,8 @@ supabase = create_client(SUPABASE_URL, SUPABASE_KEY)
23
  model = sio.load("rf_house_price_model.skops")
24
  #titanic_model = joblib.load("titanic_rf_model.joblib")
25
  titanic_model = sio.load("titanic_rf_model.skops")
26
- # # Load Heart Disease model
27
- # heart_model = sio.load("heart_rf.skops")
28
 
29
 
30
  # -------- Routes --------
@@ -141,31 +141,31 @@ def titanic():
141
 
142
  return render_template("titanic.html", prediction=prediction)
143
 
144
- # @app.route("/heart", methods=["GET", "POST"])
145
- # def heart_predict():
146
- # if "username" not in session:
147
- # return redirect(url_for("login"))
148
-
149
- # prediction = None
150
- # if request.method == "POST":
151
- # features = [
152
- # float(request.form["age"]),
153
- # float(request.form["sex"]),
154
- # float(request.form["cp"]),
155
- # float(request.form["trestbps"]),
156
- # float(request.form["chol"]),
157
- # float(request.form["fbs"]),
158
- # float(request.form["restecg"]),
159
- # float(request.form["thalach"]),
160
- # float(request.form["exang"]),
161
- # float(request.form["oldpeak"]),
162
- # float(request.form["slope"]),
163
- # float(request.form["ca"]),
164
- # float(request.form["thal"])
165
- # ]
166
- # prediction = heart_model.predict([features])[0]
167
-
168
- # return render_template("heart.html", prediction=prediction)
169
 
170
 
171
 
 
23
  model = sio.load("rf_house_price_model.skops")
24
  #titanic_model = joblib.load("titanic_rf_model.joblib")
25
  titanic_model = sio.load("titanic_rf_model.skops")
26
+ # Load Heart Disease model
27
+ heart_model = sio.load("heart_rf.skops")
28
 
29
 
30
  # -------- Routes --------
 
141
 
142
  return render_template("titanic.html", prediction=prediction)
143
 
144
+ @app.route("/heart", methods=["GET", "POST"])
145
+ def heart():
146
+ if "username" not in session:
147
+ return redirect(url_for("login"))
148
+
149
+ prediction = None
150
+ if request.method == "POST":
151
+ features = [
152
+ float(request.form["age"]),
153
+ float(request.form["sex"]),
154
+ float(request.form["cp"]),
155
+ float(request.form["trestbps"]),
156
+ float(request.form["chol"]),
157
+ float(request.form["fbs"]),
158
+ float(request.form["restecg"]),
159
+ float(request.form["thalach"]),
160
+ float(request.form["exang"]),
161
+ float(request.form["oldpeak"]),
162
+ float(request.form["slope"]),
163
+ float(request.form["ca"]),
164
+ float(request.form["thal"])
165
+ ]
166
+ prediction = heart_model.predict([features])[0]
167
+
168
+ return render_template("heart.html", prediction=prediction)
169
 
170
 
171