KikoDM commited on
Commit
2ff9125
1 Parent(s): 7101ce3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -25
app.py CHANGED
@@ -3,7 +3,7 @@ import pandas as pd
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
  {
@@ -18,40 +18,40 @@ def humands(Sex,Age,Monthlyincome,TotalWorkingYears,DistanceFromHome,Overtime,Ye
18
  "YearsAtCompany" : [YearsAtCompany],
19
  "MonthlyRate" : [Monthlyincome*2],
20
  "NumCompaniesWorked" : [NumCompaniesWorked],
21
- "PercentSalaryHike" : [0],
22
- "YearsInCurrentRole" : [0],
23
- "YearsWithCurrManager" : [0],
24
- "StockOptionLevel" : [0],
25
- "YearsSinceLastPromotion" : [0],
26
- "JobSatisfaction" : [0],
27
- "JobLevel" : [0],
28
  "TrainingTimesLastYear" : [0],
29
- "EnvironmentSatisfaction" : [0],
30
- "WorkLifeBalance" : [0],
31
- "MaritalStatus_Single" : [0],
32
- "JobInvolvement" : [0],
33
- "RelationshipSatisfaction" : [0],
34
- "Education" : [0],
35
- "BusinessTravel_Travel_Frequently" : [0],
36
  "JobRole_Sales Representative" : [0],
37
  "EducationField_Medical" : [0],
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],
49
- "JobRole_Research Scientist" : [0],
50
  "EducationField_Marketing" : [0],
51
- "PerformanceRating" : [0],
52
  "EducationField_Other" : [0],
53
  "JobRole_Human Resources" : [0],
54
- "BusinessTravel_Non-Travel" : [0],
55
  "Department_Human Resources" : [0],
56
  "JobRole_Manufacturing Director" : [0],
57
  "JobRole_Healthcare Representative" : [0],
@@ -80,6 +80,7 @@ iface = gr.Interface(
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"),
@@ -91,9 +92,9 @@ iface = gr.Interface(
91
 
92
  "text",
93
  examples=[
94
- ["Mujer",25,1500,20,2,True,2,2],
95
- ["Hombre",25,1500,20,2,False,2,2],
96
- ["Hombre",25,1500,20,2,True,2,2],
97
  ],
98
  interpretation="default",
99
  title = 'Student Experience: cómo mejorar la experiencia de aprendizaje en la universidad',
 
3
  from joblib import load
4
 
5
 
6
+ def humands(Sex,Age,Married,Monthlyincome,TotalWorkingYears,DistanceFromHome,Overtime,YearsAtCompany,NumCompaniesWorked):
7
  model = load('modelo_entrenado.pkl')
8
  df = pd.DataFrame.from_dict(
9
  {
 
18
  "YearsAtCompany" : [YearsAtCompany],
19
  "MonthlyRate" : [Monthlyincome*2],
20
  "NumCompaniesWorked" : [NumCompaniesWorked],
21
+ "PercentSalaryHike" : [15],
22
+ "YearsInCurrentRole" : [YearsAtCompany-1],
23
+ "YearsWithCurrManager" : [YearsAtCompany-1],
24
+ "StockOptionLevel" : [1],
25
+ "YearsSinceLastPromotion" : [YearsAtCompany-1],
26
+ "JobSatisfaction" : [2],
27
+ "JobLevel" : [3],
28
  "TrainingTimesLastYear" : [0],
29
+ "EnvironmentSatisfaction" : [2],
30
+ "WorkLifeBalance" : [2],
31
+ "MaritalStatus_Single" : [1 if Married==0 else 0],
32
+ "JobInvolvement" : [2],
33
+ "RelationshipSatisfaction" : [Married+1],
34
+ "Education" : [2],
35
+ "BusinessTravel_Travel_Frequently" : [1 if Overtime else 0],
36
  "JobRole_Sales Representative" : [0],
37
  "EducationField_Medical" : [0],
38
  "Department_Sales" : [0],
39
  "JobRole_Laboratory Technician" : [0],
40
+ "Department_Research & Development" : [1],
41
  "Gender_Female" : [1 if Sex==0 else 0],
42
+ "MaritalStatus_Married" : [1 if Married==1 else 0],
43
  "JobRole_Sales Executive" : [0],
44
+ "EducationField_Technical Degree" : [1],
45
  "Gender_Male" : [1 if Sex==1 else 0],
46
  "EducationField_Life Sciences" : [0],
47
  "BusinessTravel_Travel_Rarely" : [0],
48
+ "MaritalStatus_Divorced" : [1 if Married==2 else 0],
49
+ "JobRole_Research Scientist" : [1],
50
  "EducationField_Marketing" : [0],
51
+ "PerformanceRating" : [3],
52
  "EducationField_Other" : [0],
53
  "JobRole_Human Resources" : [0],
54
+ "BusinessTravel_Non-Travel" : [1 if not Overtime else 0],
55
  "Department_Human Resources" : [0],
56
  "JobRole_Manufacturing Director" : [0],
57
  "JobRole_Healthcare Representative" : [0],
 
80
  [
81
  gr.Radio(["Mujer","Hombre"],type = "index",label="Sexo"),
82
  gr.inputs.Slider(18,70,1,label="Edad del trabajador"),
83
+ gr.Radio(["Soltero","Casado","Divorciado"],type = "index",label="Esstado civil:"),
84
  gr.inputs.Slider(1000,20000,1,label="Ingresos mensuales del trabajador"),
85
  gr.inputs.Slider(0,40,1,label="Total de años trabajados del trabajador"),
86
  gr.inputs.Slider(0,100,1,label="Distancia del trabajo al domicilio en Km"),
 
92
 
93
  "text",
94
  examples=[
95
+ ["Mujer",25,"Soltero",1500,20,2,True,2,2],
96
+ ["Hombre",25,"Casado",1500,20,2,False,2,2],
97
+ ["Hombre",25,"Divordiado",1500,20,2,True,2,2],
98
  ],
99
  interpretation="default",
100
  title = 'Student Experience: cómo mejorar la experiencia de aprendizaje en la universidad',