File size: 670 Bytes
dfb94a5
3d95457
 
 
dfb94a5
3d95457
dfb94a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class']

import gradio as gr
import sklearn
import joblib

loaded_model = joblib.load('trained_model.pkl')

def predict(preg, plas, pres, skin, test, mass, pedi, age):

    result = loaded_model.predict([[float(preg), float(plas), float(pres), float(skin), int(test), float(mass), float(pedi), float(age)]])
    if int(result[0]) == 1:
      return "The person is diabetic"
    else:
      return "The person is not diabetic"
    #return str(result)

demo = gr.Interface(
    fn = predict,
    inputs = ["text", "text","text", "text","text", "text","text", "text"],
    outputs=["text"],
)

demo.launch()