KikoDM commited on
Commit
3aabd65
1 Parent(s): 1015725

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -3,7 +3,7 @@ import pandas as pd
3
  from joblib import load
4
 
5
 
6
- def humands(Monthlyincome,Age,TotalWorkingYears,DistanceFromHome,Overtime,YearsAtCompany,NumCompaniesWorked):
7
  model = load('modelo_entrenado.pkl')
8
  df = pd.DataFrame.from_dict(
9
  {
@@ -13,8 +13,8 @@ def humands(Monthlyincome,Age,TotalWorkingYears,DistanceFromHome,Overtime,YearsA
13
  "DailyRate" : [Monthlyincome*2/30],
14
  "HourlyRate" : [Monthlyincome*2/1640],
15
  "DistanceFromHome" : [DistanceFromHome],
16
- "OverTime_Yes" : [0 if Overtime else 1],
17
- "OverTime_No" : [0 if not Overtime else 1],
18
  "YearsAtCompany" : [YearsAtCompany],
19
  "MonthlyRate" : [Monthlyincome*2],
20
  "NumCompaniesWorked" : [NumCompaniesWorked],
@@ -38,11 +38,11 @@ def humands(Monthlyincome,Age,TotalWorkingYears,DistanceFromHome,Overtime,YearsA
38
  "Department_Sales" : [0],
39
  "JobRole_Laboratory Technician" : [0],
40
  "Department_Research & Development" : [0],
41
- "Gender_Female" : [0],
42
  "MaritalStatus_Married" : [0],
43
  "JobRole_Sales Executive" : [0],
44
  "EducationField_Technical Degree" : [0],
45
- "Gender_Male" : [0],
46
  "EducationField_Life Sciences" : [0],
47
  "BusinessTravel_Travel_Rarely" : [0],
48
  "MaritalStatus_Divorced" : [0],
@@ -78,8 +78,9 @@ def humands(Monthlyincome,Age,TotalWorkingYears,DistanceFromHome,Overtime,YearsA
78
  iface = gr.Interface(
79
  humands,
80
  [
81
- gr.inputs.Slider(1000,20000,1,label="Ingresos mensuales del trabajador"),
82
  gr.inputs.Slider(18,70,1,label="Edad del trabajador"),
 
83
  gr.inputs.Slider(0,40,1,label="Total de años trabajados del trabajador"),
84
  gr.inputs.Slider(0,100,1,label="Distancia del trabajo al domicilio en Km"),
85
  gr.Checkbox(label="¿Realiza horas extras habitualmente?"),
 
3
  from joblib import load
4
 
5
 
6
+ def humands(Sex,Age,Monthlyincome,TotalWorkingYears,DistanceFromHome,Overtime,YearsAtCompany,NumCompaniesWorked):
7
  model = load('modelo_entrenado.pkl')
8
  df = pd.DataFrame.from_dict(
9
  {
 
13
  "DailyRate" : [Monthlyincome*2/30],
14
  "HourlyRate" : [Monthlyincome*2/1640],
15
  "DistanceFromHome" : [DistanceFromHome],
16
+ "OverTime_Yes" : [1 if Overtime else 0],
17
+ "OverTime_No" : [1 if not Overtime else 0],
18
  "YearsAtCompany" : [YearsAtCompany],
19
  "MonthlyRate" : [Monthlyincome*2],
20
  "NumCompaniesWorked" : [NumCompaniesWorked],
 
38
  "Department_Sales" : [0],
39
  "JobRole_Laboratory Technician" : [0],
40
  "Department_Research & Development" : [0],
41
+ "Gender_Female" : [1 if Sex==0 else 0],
42
  "MaritalStatus_Married" : [0],
43
  "JobRole_Sales Executive" : [0],
44
  "EducationField_Technical Degree" : [0],
45
+ "Gender_Male" : [1 if Sex==1 else 0],
46
  "EducationField_Life Sciences" : [0],
47
  "BusinessTravel_Travel_Rarely" : [0],
48
  "MaritalStatus_Divorced" : [0],
 
78
  iface = gr.Interface(
79
  humands,
80
  [
81
+ gr.Radio(["Mujer","Hombre"],type = "index",label="Sexo")
82
  gr.inputs.Slider(18,70,1,label="Edad del trabajador"),
83
+ gr.inputs.Slider(1000,20000,1,label="Ingresos mensuales del trabajador"),
84
  gr.inputs.Slider(0,40,1,label="Total de años trabajados del trabajador"),
85
  gr.inputs.Slider(0,100,1,label="Distancia del trabajo al domicilio en Km"),
86
  gr.Checkbox(label="¿Realiza horas extras habitualmente?"),