Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
shatakshisingh24 authored Jul 2, 2021
1 parent 3af6d80 commit e9a5ed4
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 0 deletions.
53 changes: 53 additions & 0 deletions DTEMP1.py
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'



35 changes: 35 additions & 0 deletions app.py
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)

46 changes: 46 additions & 0 deletions templates/index.html
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 added www/saved_model.pb
Binary file not shown.
Binary file added www/variables/variables.data-00000-of-00001
Binary file not shown.
Binary file added www/variables/variables.index
Binary file not shown.

0 comments on commit e9a5ed4

Please sign in to comment.