-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3af6d80
commit e9a5ed4
Showing
6 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env python | ||
# coding: utf-8 | ||
|
||
# In[16]: | ||
|
||
|
||
import pandas as pd | ||
import numpy as np | ||
from keras import models | ||
from keras.models import load_model | ||
from tensorflow import keras | ||
|
||
|
||
# In[17]: | ||
|
||
|
||
|
||
model = keras.models.load_model('www') | ||
|
||
|
||
# In[30]: | ||
|
||
|
||
def pred(age,fpg,diabp,sysbp,bmi,avgsugar,wcir,hcir,chol,ogtt): | ||
mean=np.array([ 47.57372401, 152.46691871, 80.99243856, 130.42627599, | ||
25.15104344, 7.84291115, 95.4073724 , 98.72117202, | ||
237.63610586, 217.36672968]) | ||
dev=np.array([13.949183 , 73.80475753, 4.83384664, 12.72021721, 3.98544049, | ||
2.3917692 , 11.75528716, 10.05522809, 50.12737702, 91.57451541]) | ||
x=np.zeros(10) | ||
x[0]=age | ||
x[1]=fpg | ||
x[2]=diabp | ||
x[3]=sysbp | ||
x[4]=bmi | ||
x[5]=avgsugar | ||
x[6]=wcir | ||
x[7]=hcir | ||
x[8]=chol | ||
x[9]=ogtt | ||
|
||
for i in range(0,10): | ||
x[i]=(x[i]-mean[i])/dev[i] | ||
x=x.reshape((1,10,-1)) | ||
out= model.predict([x]) | ||
|
||
if(out[0][0]>0.5): | ||
return 'Diabetic' | ||
else: | ||
return 'Non-Diabetic' | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from flask import Flask, render_template, redirect, request | ||
import DTEMP1 | ||
|
||
app=Flask(__name__) | ||
|
||
|
||
@app.route('/') | ||
def hello(): | ||
return render_template("index.html") | ||
|
||
@app.route('/', methods= ['POST']) | ||
def marks(): | ||
if request.method == 'POST': | ||
age = request.form['age'] | ||
fpg = request.form['fpg'] | ||
diabp = int(request.form['diabp']) | ||
sysbp = float(request.form['sysbp']) | ||
bmi= float(request.form['bmi']) | ||
avgsugar= float(request.form['avgsugar']) | ||
wcir = float(request.form['wcir']) | ||
hcir = float(request.form['hcir']) | ||
chol = float(request.form['chol']) | ||
ogtt = float(request.form['ogtt']) | ||
|
||
result= DTEMP1.pred(age, fpg, diabp, sysbp, bmi, avgsugar, wcir, hcir, chol, ogtt) | ||
result_dic={ | ||
'Result':result | ||
} | ||
|
||
return render_template("index.html", result_out= result_dic) | ||
|
||
|
||
if __name__=='__main__': | ||
app.run(debug=True) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<title>Diabetes Diagnosis</title> | ||
</head> | ||
<body> | ||
|
||
<div class="main-page"> | ||
<div class="page-content"> | ||
<h2>Enter the Details for Diabetes Diagnosis</h2> | ||
<form method="POST" action="/" enctype="multipart/form-data"> | ||
<input type="text" name="age" placeholder="Age"> | ||
<br> | ||
<input type="text" name="fpg" placeholder="Fasting Plasma Glucose"> | ||
<br> | ||
<input type="text" name="diabp" placeholder="Diastolic BP"> | ||
<br> | ||
<input type="text" name="sysbp" placeholder="Systolic BP"> | ||
<br> | ||
<input type="text" name="bmi" placeholder="BMI"> | ||
<br> | ||
<input type="text" name="avgsugar" placeholder="Average Blood Sugar"> | ||
<br> | ||
<input type="text" name="wcir" placeholder="Waist Circumference"> | ||
<br> | ||
<input type="text" name="hcir" placeholder="Hip Circumference"> | ||
<br> | ||
<input type="text" name="chol" placeholder="Cholestrol"> | ||
<br> | ||
<input type="text" name="ogtt" placeholder="OGTT"> | ||
<br> | ||
|
||
<input type="submit"> | ||
</form> | ||
|
||
{% if result_out %} | ||
<br> | ||
<h2>Predicted Result :{{result_out['Result']}}</h2> | ||
|
||
{% endif %} | ||
</div> | ||
</div> | ||
</body> | ||
</html> | ||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.