Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


### Overview
In this project, the objective is to predict whether the person has Diabetes or not based on various features suach as
In this project, the objective is to predict whether the person has Diabetes or not based on various features such as
- Pregnancies
- Insulin Level
- Age
Expand Down
68 changes: 34 additions & 34 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# Importing essential libraries
from flask import Flask, render_template, request
import pickle
import numpy as np
# Load the Random Forest CLassifier model
filename = 'diabetes-prediction-rfc-model.pkl'
classifier = pickle.load(open(filename, 'rb'))
app = Flask(__name__)
@app.route('/')
def home():
return render_template('index.html')
@app.route('/predict', methods=['POST'])
def predict():
if request.method == 'POST':
preg = int(request.form['pregnancies'])
glucose = int(request.form['glucose'])
bp = int(request.form['bloodpressure'])
st = int(request.form['skinthickness'])
insulin = int(request.form['insulin'])
bmi = float(request.form['bmi'])
dpf = float(request.form['dpf'])
age = int(request.form['age'])
data = np.array([[preg, glucose, bp, st, insulin, bmi, dpf, age]])
my_prediction = classifier.predict(data)
return render_template('result.html', prediction=my_prediction)
if __name__ == '__main__':
app.run(debug=True)
# Importing essential libraries
from flask import Flask, render_template, request
import pickle
import numpy as np

# Load the Random Forest Classifier model
filename = 'diabetes-prediction-rfc-model.pkl'
classifier = pickle.load(open(filename, 'rb'))

app = Flask(__name__)

@app.route('/')
def home():
return render_template('index.html')

@app.route('/predict', methods=['POST'])
def predict():
if request.method == 'POST':
preg = int(request.form['pregnancies'])
glucose = int(request.form['glucose'])
bp = int(request.form['bloodpressure'])
st = int(request.form['skinthickness'])
insulin = int(request.form['insulin'])
bmi = float(request.form['bmi'])
dpf = float(request.form['dpf'])
age = int(request.form['age'])

data = np.array([[preg, glucose, bp, st, insulin, bmi, dpf, age]])
my_prediction = classifier.predict(data)

return render_template('result.html', prediction=my_prediction)

if __name__ == '__main__':
app.run(debug=True)