Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import joblib | |
| model = joblib.load("model.pkl") | |
| def predict(Pregnancies, Glucose, BP, Skin, Insulin, BMI, DPF, Age): | |
| data = [[Pregnancies, Glucose, BP, Skin, Insulin, BMI, DPF, Age]] | |
| result = model.predict(data)[0] | |
| return "Diabetic" if result == 1 else "Not Diabetic" | |
| app = gr.Interface( | |
| fn=predict, | |
| inputs=[ | |
| gr.Number(label="Pregnancies"), | |
| gr.Number(label="Glucose"), | |
| gr.Number(label="Blood Pressure"), | |
| gr.Number(label="Skin Thickness"), | |
| gr.Number(label="Insulin"), | |
| gr.Number(label="BMI"), | |
| gr.Number(label="Diabetes Pedigree Function"), | |
| gr.Number(label="Age") | |
| ], | |
| outputs="text", | |
| title="Diabetes Prediction App" | |
| ) | |
| app.launch() | |