Spaces:
Runtime error
Runtime error
Delete app.py
Browse files
app.py
DELETED
@@ -1,48 +0,0 @@
|
|
1 |
-
# -*- coding: utf-8 -*-
|
2 |
-
"""app.ipynb
|
3 |
-
|
4 |
-
Automatically generated by Colaboratory.
|
5 |
-
|
6 |
-
Original file is located at
|
7 |
-
https://colab.research.google.com/drive/1I-y23tTTs_aMjSYwPa3Fk8Ywz8H8ZUgl
|
8 |
-
|
9 |
-
#**GRADIO**
|
10 |
-
"""
|
11 |
-
|
12 |
-
import gradio as gr
|
13 |
-
import joblib as jb
|
14 |
-
|
15 |
-
def predict(sex, age, hypertension, heart_disease, ever_married, work_type, Residence_type, avg_glucose_level, bmi, smoking_status):
|
16 |
-
model = jb.load('model.pkl')
|
17 |
-
sex = str(sex)
|
18 |
-
age = int(age)
|
19 |
-
hypertension = str(hypertension)
|
20 |
-
heart_disease = str(heart_disease)
|
21 |
-
ever_married = str(ever_married)
|
22 |
-
work_type = str(work_type)
|
23 |
-
Residence_type = int(Residence_type)
|
24 |
-
avg_glucose_level = float(avg_glucose_level )
|
25 |
-
bmi = float(bmi)
|
26 |
-
smoking_status = str(smoking_status)
|
27 |
-
|
28 |
-
|
29 |
-
p = model.predict({{sex, age, hypertension, heart_disease, ever_married, work_type, Residence_type, avg_glucose_level, bmi, smoking_status}})[0]
|
30 |
-
|
31 |
-
return {"Não terá AVC": p[0], "Terá AVC": p[1]}
|
32 |
-
|
33 |
-
demo = gr.Interface(fn=predict,
|
34 |
-
inputs=[gr.Dropdown(choices=["female", "male"], type="index"),
|
35 |
-
"number",
|
36 |
-
gr.Dropdown(choices=["Não Hipertenso", "Hipertenso"], type="index"),
|
37 |
-
gr.Dropdown(choices=["Não doença cardíaca", "Possui doença cardíaca"], type="index"),
|
38 |
-
gr.Dropdown(choices=["Não casado(a)", "Casado(a)"], type="index"),
|
39 |
-
gr.Dropdown(choices=["Nunca trabalhou", "filhos", "Emprego público", "Autônomo", "Privado"], type="index"),
|
40 |
-
gr.Dropdown(choices=["Rural", "Urbana"], type="index"),
|
41 |
-
"number",
|
42 |
-
"number",
|
43 |
-
gr.Dropdown(choices=["Nunca fumou", "Fuma"], type="index"),
|
44 |
-
],
|
45 |
-
outputs="label")
|
46 |
-
|
47 |
-
|
48 |
-
demo.launch(share=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|