umair894 commited on
Commit
d8e438e
·
verified ·
1 Parent(s): 806ace2

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ #['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class']
3
+ import joblib
4
+ loaded_model = joblib.load('trained_model.pkl')
5
+ def predict(preg, plas, pres, skin, test, mass, pedi, age):
6
+
7
+ result = loaded_model.predict([[int(preg), int(plas), int(pres), int(skin), int(test), int(mass), int(pedi), int(age)]])
8
+ if int(result[0]) == 1:
9
+ return "The person is diabetic"
10
+ else:
11
+ return "The person is not diabetic"
12
+ #return str(result)
13
+
14
+ demo = gr.Interface(
15
+ fn=predict,
16
+ inputs=["text", "text","text", "text","text", "text","text", "text"],
17
+ outputs=["text"],
18
+ )
19
+
20
+ demo.launch()