Spaces:
Runtime error
Runtime error
Rehman1603
commited on
Commit
·
251357e
1
Parent(s):
f36a361
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pickle
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
with open("Diabetic_Model","rb") as f:
|
5 |
+
mp=pickle.load(f)
|
6 |
+
|
7 |
+
|
8 |
+
def Diabetic_Prediction(Pregnancies,Glucose,BP,ST,Insuline,BMI,DPF,Age):
|
9 |
+
Pregnancies=int(Pregnancies)
|
10 |
+
Glucose=int(Glucose)
|
11 |
+
BP=int(BP)
|
12 |
+
ST=int(ST)
|
13 |
+
Insuline=int(Insuline)
|
14 |
+
BMI=float(BMI)
|
15 |
+
DPF=float(DPF)
|
16 |
+
Age=int(Age)
|
17 |
+
value=mp.predict([[Pregnancies,Glucose,BP,ST,Insuline,BMI,DPF,Age]])
|
18 |
+
if(value[0]==0):
|
19 |
+
result="You don't have Diabties"
|
20 |
+
elif(value[0]==1):
|
21 |
+
result="You have Diabties"
|
22 |
+
return result
|
23 |
+
|
24 |
+
interface=gr.Interface(fn=Diabetic_Prediction,inputs=[gr.inputs.Textbox(lines=2,placeholder="Enter Pregnancies Time"),
|
25 |
+
gr.inputs.Textbox(lines=2,placeholder="Enter Glucose Level"),gr.inputs.Textbox(lines=2,placeholder="Enter Blood Pressure"),gr.inputs.Textbox(lines=2,placeholder="Enter Skin Thickness"),gr.inputs.Textbox(lines=2,placeholder="Enter Insulin Level"),gr.inputs.Textbox(lines=2,placeholder="Enter BMI Level"),gr.inputs.Textbox(lines=2,placeholder="Enter Diabbetes Predigree Function"),gr.inputs.Textbox(lines=2,placeholder="Enter Your Age")],
|
26 |
+
outputs=[gr.outputs.Textbox(label="Your Result")],
|
27 |
+
enable_queu=True
|
28 |
+
)
|
29 |
+
interface.launch(debug=True)
|