Spaces:
Runtime error
Runtime error
Download predict_page.py from LawalAfeez/dev-sal-predict: direct link, hf CLI and curl.
- Browser
- Download file 1.33 kB
-
https://huggingface.co/spaces/LawalAfeez/dev-sal-predict/resolve/main/predict_page.py
- Command line
-
hf download hf://spaces/LawalAfeez/dev-sal-predict/predict_page.py
-
curl -L -o predict_page.py https://huggingface.co/spaces/LawalAfeez/dev-sal-predict/resolve/main/predict_page.py
1.33 kB
| import streamlit as st | |
| import pickle | |
| import numpy as np | |
| model=pickle.load(open("model.pkl","rb")) | |
| trans_count=pickle.load(open("trans_count.pkl","rb")) | |
| trans_edu=pickle.load(open("trans_edu.pkl","rb")) | |
| print(st.__version__) | |
| def show_predict_page(): | |
| st.title("Software Developer Salary Prediction") | |
| st.write("""## we need some information to predict salary""") | |
| countries=("United States", | |
| "India", | |
| "United Kingdom", | |
| "Germany", | |
| "Canada", | |
| "Brazil", | |
| "France" , | |
| "Spain", | |
| "Australia", | |
| "Netherlands", | |
| "Poland", | |
| "Italy", | |
| "Russian Federation", | |
| "Sweden") | |
| education=("Bachelor’s degree", "Master’s degree", "Post grad","Less than a Bachelors") | |
| country=st.selectbox("Country" ,countries) | |
| education=st.selectbox("Education Level",education) | |
| experience=st.slider("Year of EXperience",0,50,3) | |
| ok=st.button("Calculate Salary") | |
| if ok: | |
| test=np.array([[country,education,experience]]) | |
| test[:,0]=trans_count.transform(test[:,0]) | |
| test[:,1]=trans_edu.transform(test[:,1]) | |
| test=test.astype(float) | |
| salary=model.predict(test) | |
| st.subheader(f"The estimated average salary per year is ${salary[0]:.2f}") |