Spaces:
Sleeping
Sleeping
Create app.py
Browse files
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()
|