Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -26,40 +26,44 @@ def main():
|
|
26 |
|
27 |
# Add inputs for user to input data
|
28 |
col1, col2, col3 = st.columns(3)
|
|
|
29 |
with col1:
|
30 |
age = st.slider("Age", min_value=18, max_value=70, value=30)
|
|
|
31 |
environment_satisfaction = st.slider("Environment Satisfaction", min_value=1, max_value=4, value=2)
|
|
|
32 |
job_satisfaction = st.slider("Job Satisfaction", min_value=1, max_value=4, value=2)
|
33 |
-
|
34 |
-
over_time = st.checkbox("Over Time")
|
35 |
with col2:
|
36 |
-
|
37 |
-
job_involvement = st.slider("Job Involvement", min_value=1, max_value=4, value=2)
|
38 |
num_companies_worked = st.slider("Number of Companies Worked", min_value=0, max_value=10, value=2)
|
39 |
percent_salary_hike = st.slider("Percent Salary Hike", min_value=10, max_value=25, value=15)
|
40 |
stock_option_level = st.slider("Stock Option Level", min_value=0, max_value=3, value=1)
|
41 |
-
with col3:
|
42 |
training_times_last_year = st.slider("Training Times Last Year", min_value=0, max_value=6, value=2)
|
|
|
|
|
43 |
work_life_balance = st.slider("Work Life Balance", min_value=1, max_value=4, value=2)
|
44 |
years_since_last_promotion = st.slider("Years Since Last Promotion", min_value=0, max_value=15, value=3)
|
45 |
years_with_curr_manager = st.slider("Years With Current Manager", min_value=0, max_value=15, value=3)
|
46 |
-
|
|
|
|
|
47 |
# Create a DataFrame to hold the user input data
|
48 |
input_data = pd.DataFrame({
|
49 |
'Age': [age],
|
50 |
'DistanceFromHome': [distance_from_home],
|
51 |
'EnvironmentSatisfaction': [environment_satisfaction],
|
|
|
52 |
'JobSatisfaction': [job_satisfaction],
|
53 |
'MonthlyIncome': [monthly_income],
|
54 |
'NumCompaniesWorked': [num_companies_worked],
|
55 |
-
'OverTime': [over_time],
|
56 |
-
'JobInvolvement': [job_involvement],
|
57 |
'PercentSalaryHike': [percent_salary_hike],
|
58 |
'StockOptionLevel': [stock_option_level],
|
59 |
'TrainingTimesLastYear': [training_times_last_year],
|
60 |
'WorkLifeBalance': [work_life_balance],
|
61 |
'YearsSinceLastPromotion': [years_since_last_promotion],
|
62 |
-
'YearsWithCurrManager': [years_with_curr_manager]
|
|
|
63 |
})
|
64 |
|
65 |
# Make predictions
|
|
|
26 |
|
27 |
# Add inputs for user to input data
|
28 |
col1, col2, col3 = st.columns(3)
|
29 |
+
|
30 |
with col1:
|
31 |
age = st.slider("Age", min_value=18, max_value=70, value=30)
|
32 |
+
distance_from_home = st.slider("Distance From Home", min_value=1, max_value=30, value=10)
|
33 |
environment_satisfaction = st.slider("Environment Satisfaction", min_value=1, max_value=4, value=2)
|
34 |
+
hourly_rate = st.slider("Hourly Rate", min_value=30, max_value=100, value=65)
|
35 |
job_satisfaction = st.slider("Job Satisfaction", min_value=1, max_value=4, value=2)
|
36 |
+
|
|
|
37 |
with col2:
|
38 |
+
monthly_income = st.slider("Monthly Income", min_value=1000, max_value=20000, value=5000)
|
|
|
39 |
num_companies_worked = st.slider("Number of Companies Worked", min_value=0, max_value=10, value=2)
|
40 |
percent_salary_hike = st.slider("Percent Salary Hike", min_value=10, max_value=25, value=15)
|
41 |
stock_option_level = st.slider("Stock Option Level", min_value=0, max_value=3, value=1)
|
|
|
42 |
training_times_last_year = st.slider("Training Times Last Year", min_value=0, max_value=6, value=2)
|
43 |
+
|
44 |
+
with col3:
|
45 |
work_life_balance = st.slider("Work Life Balance", min_value=1, max_value=4, value=2)
|
46 |
years_since_last_promotion = st.slider("Years Since Last Promotion", min_value=0, max_value=15, value=3)
|
47 |
years_with_curr_manager = st.slider("Years With Current Manager", min_value=0, max_value=15, value=3)
|
48 |
+
|
49 |
+
over_time = st.checkbox("Over Time")
|
50 |
+
|
51 |
# Create a DataFrame to hold the user input data
|
52 |
input_data = pd.DataFrame({
|
53 |
'Age': [age],
|
54 |
'DistanceFromHome': [distance_from_home],
|
55 |
'EnvironmentSatisfaction': [environment_satisfaction],
|
56 |
+
'HourlyRate': [hourly_rate],
|
57 |
'JobSatisfaction': [job_satisfaction],
|
58 |
'MonthlyIncome': [monthly_income],
|
59 |
'NumCompaniesWorked': [num_companies_worked],
|
|
|
|
|
60 |
'PercentSalaryHike': [percent_salary_hike],
|
61 |
'StockOptionLevel': [stock_option_level],
|
62 |
'TrainingTimesLastYear': [training_times_last_year],
|
63 |
'WorkLifeBalance': [work_life_balance],
|
64 |
'YearsSinceLastPromotion': [years_since_last_promotion],
|
65 |
+
'YearsWithCurrManager': [years_with_curr_manager],
|
66 |
+
'OverTime': [over_time]
|
67 |
})
|
68 |
|
69 |
# Make predictions
|