Heart_attack / app.py
ShadowTEM's picture
Update app.py
be6d5da verified
Raw
History Blame Contribute Delete
744 Bytes
from flask import Flask, render_template, request
from deployment.controller.GetPredictions import GetPredictions
from deployment.controller.LoadModel import LoadModel
app = Flask(__name__,template_folder='deployment/templates')
model = LoadModel('deployment/models/heart_attack_detection_model_99.3%.pkl')
@app.route('/')
def home():
print("Rendering home page...") # Debug log
return render_template('home.html')
@app.route('/predict', methods=['POST'])
def predict():
if request.method == 'POST':
inputs = request.form.to_dict()
prediction = GetPredictions(model, inputs)
return render_template('result.html', prediction=prediction)
if __name__ == '__main__':
app.run(host="0.0.0.0", port=7860)