Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,43 +1,75 @@
|
|
| 1 |
-
import
|
| 2 |
-
import
|
| 3 |
-
import os
|
| 4 |
import pandas as pd
|
| 5 |
-
import
|
| 6 |
import pickle
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import numpy as np
|
|
|
|
| 3 |
import pandas as pd
|
| 4 |
+
import joblib
|
| 5 |
import pickle
|
| 6 |
|
| 7 |
+
model = pickle.load(open("PycaretGBR.pkl", 'rb'))
|
| 8 |
+
# model = joblib.load("lr.joblib")
|
| 9 |
+
st.title('Developer Salary Prediction 2024')
|
| 10 |
+
st.write("""### We need some information to predict the salary""")
|
| 11 |
+
|
| 12 |
+
countries = (
|
| 13 |
+
"Australia",
|
| 14 |
+
"Austria",
|
| 15 |
+
"Belgium",
|
| 16 |
+
"Brazil",
|
| 17 |
+
"Canada",
|
| 18 |
+
"Czech Republic",
|
| 19 |
+
"Denmark",
|
| 20 |
+
"France",
|
| 21 |
+
"Germany",
|
| 22 |
+
"India",
|
| 23 |
+
"Israel",
|
| 24 |
+
"Italy",
|
| 25 |
+
"Netherlands",
|
| 26 |
+
"Norway",
|
| 27 |
+
"Poland",
|
| 28 |
+
"Russian Federation",
|
| 29 |
+
"Spain",
|
| 30 |
+
"Sweden",
|
| 31 |
+
"Switzerland",
|
| 32 |
+
"Ukraine"
|
| 33 |
+
"United Kingdom of Great Britain and Northern Ireland",
|
| 34 |
+
"United States of America"
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
education = (
|
| 38 |
+
"Less than a Bachelors",
|
| 39 |
+
"Bachelor’s degree",
|
| 40 |
+
"Master’s degree",
|
| 41 |
+
"Post grad"
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
+
employment = (
|
| 45 |
+
"Employed, full-time",
|
| 46 |
+
"Independent contractor, freelancer, or self-employed",
|
| 47 |
+
"Student, part-time",
|
| 48 |
+
"Retired",
|
| 49 |
+
"Not employed, but looking for work",
|
| 50 |
+
"Employed, part-time",
|
| 51 |
+
"Student, full-time"
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
country = st.selectbox("Country", countries)
|
| 55 |
+
education = st.selectbox("Education Level", education)
|
| 56 |
+
expericence = st.slider("Years of Experience", 0, 50, 3)
|
| 57 |
+
employment = st.selectbox("Employment Type", employment)
|
| 58 |
+
|
| 59 |
+
columns = ['Country', 'EdLevel', 'YearsCodePro', 'Employment']
|
| 60 |
+
|
| 61 |
+
ok = st.button("Calculate Salary")
|
| 62 |
+
if ok:
|
| 63 |
+
X_new_df = pd.DataFrame([[country,education,expericence,employment]],
|
| 64 |
+
columns = ['Country', 'EdLevel', 'YearsCodePro', 'Employment'])
|
| 65 |
+
print("##########")
|
| 66 |
+
print("##########")
|
| 67 |
+
print("##########")
|
| 68 |
+
print(model)
|
| 69 |
+
print("##########")
|
| 70 |
+
print("##########")
|
| 71 |
+
print("##########")
|
| 72 |
+
salary = model.predict(X_new_df)
|
| 73 |
+
|
| 74 |
+
st.subheader(f"The estimated salary is {salary[0]:.2f} $")\
|
| 75 |
+
|