Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -63,23 +63,29 @@ def main():
|
|
63 |
years_since_last_promotion = str(years_since_last_promotion)
|
64 |
years_with_curr_manager = str(years_with_curr_manager)
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
|
84 |
# Make predictions
|
85 |
prediction = model.predict(input_data)
|
|
|
63 |
years_since_last_promotion = str(years_since_last_promotion)
|
64 |
years_with_curr_manager = str(years_with_curr_manager)
|
65 |
|
66 |
+
# Create a DataFrame to hold the user input data
|
67 |
+
input_data = pd.DataFrame({
|
68 |
+
'Age': [age],
|
69 |
+
'Department': [department],
|
70 |
+
'EnvironmentSatisfaction': [environment_satisfaction],
|
71 |
+
'JobRole': [job_role],
|
72 |
+
'JobSatisfaction': [job_satisfaction],
|
73 |
+
'MonthlyIncome': [monthly_income],
|
74 |
+
'NumCompaniesWorked': [num_companies_worked],
|
75 |
+
'OverTime': [over_time],
|
76 |
+
'PercentSalaryHike': [percent_salary_hike],
|
77 |
+
'RelationshipSatisfaction': [relationship_satisfaction],
|
78 |
+
'TrainingTimesLastYear': [training_times_last_year],
|
79 |
+
'WorkLifeBalance': [work_life_balance],
|
80 |
+
'YearsSinceLastPromotion': [years_since_last_promotion],
|
81 |
+
'YearsWithCurrManager': [years_with_curr_manager]
|
82 |
+
})
|
83 |
+
|
84 |
+
# Reorder columns to match the expected order
|
85 |
+
input_data = input_data[['Age', 'Department', 'EnvironmentSatisfaction', 'JobRole', 'JobSatisfaction',
|
86 |
+
'MonthlyIncome', 'NumCompaniesWorked', 'OverTime', 'PercentSalaryHike',
|
87 |
+
'RelationshipSatisfaction', 'TrainingTimesLastYear', 'WorkLifeBalance',
|
88 |
+
'YearsSinceLastPromotion', 'YearsWithCurrManager']]
|
89 |
|
90 |
# Make predictions
|
91 |
prediction = model.predict(input_data)
|