Spaces:
Sleeping
Sleeping
mathpal123
commited on
Commit
•
dfb94a5
1
Parent(s):
d2e260f
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
|
6 |
+
def predict(preg, plas, pres, skin, test, mass, pedi, age):
|
7 |
+
|
8 |
+
result = loaded_model.predict([[float(preg), float(plas), float(pres), float(skin), int(test), float(mass), float(pedi), float(age)]])
|
9 |
+
if int(result[0]) == 1:
|
10 |
+
return "The person is diabetic"
|
11 |
+
else:
|
12 |
+
return "The person is not diabetic"
|
13 |
+
#return str(result)
|
14 |
+
|
15 |
+
demo = gr.Interface(
|
16 |
+
fn = predict,
|
17 |
+
inputs = ["text", "text","text", "text","text", "text","text", "text"],
|
18 |
+
outputs=["text"],
|
19 |
+
)
|
20 |
+
|
21 |
+
demo.launch()
|