Update app.py
Browse files
app.py
CHANGED
|
@@ -20,12 +20,25 @@ def preprocess_input(df):
|
|
| 20 |
df['TENURE'] = (df['CURRENT DATE'] - df['DOJ']).dt.days // 365.25
|
| 21 |
df['TOTAL_EXP'] = df['PAST_EXP'] + df['TENURE']
|
| 22 |
df = df.drop(columns=['DOJ', 'CURRENT DATE', 'NAME', 'PAST_EXP', 'TENURE', 'AGE'])
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
# Function to make prediction
|
| 25 |
def predict_salary(data):
|
| 26 |
-
preprocessed_data = preprocess_input(data)
|
|
|
|
| 27 |
salary = model.predict(preprocessed_data)
|
| 28 |
-
return
|
|
|
|
| 29 |
|
| 30 |
# Streamlit app
|
| 31 |
def main():
|
|
@@ -55,8 +68,10 @@ def main():
|
|
| 55 |
'RATINGS': [rating],
|
| 56 |
'DOJ': [date_of_join]
|
| 57 |
})
|
| 58 |
-
|
| 59 |
-
|
|
|
|
|
|
|
| 60 |
|
| 61 |
if __name__ == '__main__':
|
| 62 |
main()
|
|
|
|
| 20 |
df['TENURE'] = (df['CURRENT DATE'] - df['DOJ']).dt.days // 365.25
|
| 21 |
df['TOTAL_EXP'] = df['PAST_EXP'] + df['TENURE']
|
| 22 |
df = df.drop(columns=['DOJ', 'CURRENT DATE', 'NAME', 'PAST_EXP', 'TENURE', 'AGE'])
|
| 23 |
+
total_experience=int(df['TOTAL_EXP'][0])
|
| 24 |
+
# Provide salary increase recommendations based on total experience and rating
|
| 25 |
+
if total_experience >= 5 :
|
| 26 |
+
recommendation = "Your performance and experience suggest that you're well-positioned for a salary increase. Consider discussing this with your manager during your next performance review."
|
| 27 |
+
elif total_experience >= 3 :
|
| 28 |
+
recommendation = "You've gained valuable experience and have a solid performance rating. It might be a good time to explore opportunities for advancement within the company or discuss a salary review with your manager."
|
| 29 |
+
else:
|
| 30 |
+
recommendation = "Focus on enhancing your skills, gaining more experience, and improving your performance to increase your chances of a salary raise in the future."
|
| 31 |
+
|
| 32 |
+
return df,recommendation
|
| 33 |
+
|
| 34 |
+
|
| 35 |
# Function to make prediction
|
| 36 |
def predict_salary(data):
|
| 37 |
+
preprocessed_data,rec = preprocess_input(data)
|
| 38 |
+
|
| 39 |
salary = model.predict(preprocessed_data)
|
| 40 |
+
return salary,rec
|
| 41 |
+
|
| 42 |
|
| 43 |
# Streamlit app
|
| 44 |
def main():
|
|
|
|
| 68 |
'RATINGS': [rating],
|
| 69 |
'DOJ': [date_of_join]
|
| 70 |
})
|
| 71 |
+
|
| 72 |
+
salary_prediction,rec = predict_salary(input_data)
|
| 73 |
+
|
| 74 |
+
st.success(f'Predicted Salary: {salary_prediction[0]}\nRecommendation: {rec}')
|
| 75 |
|
| 76 |
if __name__ == '__main__':
|
| 77 |
main()
|