vumichien commited on
Commit
def27a0
·
1 Parent(s): 89f4618
.idea/.gitignore ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Datasource local storage ignored files
5
+ /dataSources/
6
+ /dataSources.local.xml
7
+ # Editor-based HTTP Client requests
8
+ /httpRequests/
.idea/DataScienceSalary.iml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="jdk" jdkName="Python 3.9 (DataScienceSalary)" jdkType="Python SDK" />
6
+ <orderEntry type="sourceFolder" forTests="false" />
7
+ </component>
8
+ </module>
.idea/inspectionProfiles/Project_Default.xml ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
5
+ <Languages>
6
+ <language minSize="79" name="Python" />
7
+ </Languages>
8
+ </inspection_tool>
9
+ <inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
10
+ <option name="ignoredPackages">
11
+ <value>
12
+ <list size="62">
13
+ <item index="0" class="java.lang.String" itemvalue="beautifulsoup4" />
14
+ <item index="1" class="java.lang.String" itemvalue="bs4" />
15
+ <item index="2" class="java.lang.String" itemvalue="mecab-python3" />
16
+ <item index="3" class="java.lang.String" itemvalue="pydantic" />
17
+ <item index="4" class="java.lang.String" itemvalue="joblib" />
18
+ <item index="5" class="java.lang.String" itemvalue="scikit-learn" />
19
+ <item index="6" class="java.lang.String" itemvalue="torch" />
20
+ <item index="7" class="java.lang.String" itemvalue="numpy" />
21
+ <item index="8" class="java.lang.String" itemvalue="requests" />
22
+ <item index="9" class="java.lang.String" itemvalue="unidic-lite" />
23
+ <item index="10" class="java.lang.String" itemvalue="mysql-connector-python" />
24
+ <item index="11" class="java.lang.String" itemvalue="sqlalchemy" />
25
+ <item index="12" class="java.lang.String" itemvalue="pycaret" />
26
+ <item index="13" class="java.lang.String" itemvalue="tensorflow-text" />
27
+ <item index="14" class="java.lang.String" itemvalue="keybert" />
28
+ <item index="15" class="java.lang.String" itemvalue="pandas" />
29
+ <item index="16" class="java.lang.String" itemvalue="tqdm" />
30
+ <item index="17" class="java.lang.String" itemvalue="fastapi" />
31
+ <item index="18" class="java.lang.String" itemvalue="spacy" />
32
+ <item index="19" class="java.lang.String" itemvalue="regex" />
33
+ <item index="20" class="java.lang.String" itemvalue="tensorflow-hub" />
34
+ <item index="21" class="java.lang.String" itemvalue="uvicorn" />
35
+ <item index="22" class="java.lang.String" itemvalue="xgboost" />
36
+ <item index="23" class="java.lang.String" itemvalue="onnxruntime" />
37
+ <item index="24" class="java.lang.String" itemvalue="av" />
38
+ <item index="25" class="java.lang.String" itemvalue="onnx" />
39
+ <item index="26" class="java.lang.String" itemvalue="opencv-python-headless" />
40
+ <item index="27" class="java.lang.String" itemvalue="streamlit_webrtc" />
41
+ <item index="28" class="java.lang.String" itemvalue="torchvision" />
42
+ <item index="29" class="java.lang.String" itemvalue="cdifflib" />
43
+ <item index="30" class="java.lang.String" itemvalue="protobuf" />
44
+ <item index="31" class="java.lang.String" itemvalue="python-stdnum" />
45
+ <item index="32" class="java.lang.String" itemvalue="transformers" />
46
+ <item index="33" class="java.lang.String" itemvalue="nltk" />
47
+ <item index="34" class="java.lang.String" itemvalue="sentence-transformers" />
48
+ <item index="35" class="java.lang.String" itemvalue="datasets" />
49
+ <item index="36" class="java.lang.String" itemvalue="fsspec" />
50
+ <item index="37" class="java.lang.String" itemvalue="neuralcoref" />
51
+ <item index="38" class="java.lang.String" itemvalue="dateparse" />
52
+ <item index="39" class="java.lang.String" itemvalue="faker" />
53
+ <item index="40" class="java.lang.String" itemvalue="sentencepiece" />
54
+ <item index="41" class="java.lang.String" itemvalue="langid" />
55
+ <item index="42" class="java.lang.String" itemvalue="boto3" />
56
+ <item index="43" class="java.lang.String" itemvalue="redis" />
57
+ <item index="44" class="java.lang.String" itemvalue="celery" />
58
+ <item index="45" class="java.lang.String" itemvalue="gensim" />
59
+ <item index="46" class="java.lang.String" itemvalue="PyMuPDF" />
60
+ <item index="47" class="java.lang.String" itemvalue="opencv-python" />
61
+ <item index="48" class="java.lang.String" itemvalue="h5py" />
62
+ <item index="49" class="java.lang.String" itemvalue="Shapely" />
63
+ <item index="50" class="java.lang.String" itemvalue="basemap" />
64
+ <item index="51" class="java.lang.String" itemvalue="reportlab" />
65
+ <item index="52" class="java.lang.String" itemvalue="snowflake-connector-python" />
66
+ <item index="53" class="java.lang.String" itemvalue="importlib-resources" />
67
+ <item index="54" class="java.lang.String" itemvalue="pdfplumber" />
68
+ <item index="55" class="java.lang.String" itemvalue="pymc3" />
69
+ <item index="56" class="java.lang.String" itemvalue="textract" />
70
+ <item index="57" class="java.lang.String" itemvalue="statsmodels" />
71
+ <item index="58" class="java.lang.String" itemvalue="aiohttp" />
72
+ <item index="59" class="java.lang.String" itemvalue="thinc" />
73
+ <item index="60" class="java.lang.String" itemvalue="torchaudio" />
74
+ <item index="61" class="java.lang.String" itemvalue="Pillow" />
75
+ </list>
76
+ </value>
77
+ </option>
78
+ </inspection_tool>
79
+ <inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
80
+ <option name="ignoredErrors">
81
+ <list>
82
+ <option value="N801" />
83
+ </list>
84
+ </option>
85
+ </inspection_tool>
86
+ <inspection_tool class="PyTypedDictInspection" enabled="false" level="WARNING" enabled_by_default="false" />
87
+ <inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
88
+ <option name="ignoredIdentifiers">
89
+ <list>
90
+ <option value="wbc.assets.templates.template_script.process.pattern_name" />
91
+ </list>
92
+ </option>
93
+ </inspection_tool>
94
+ </profile>
95
+ </component>
.idea/inspectionProfiles/profiles_settings.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (DataScienceSalary)" project-jdk-type="Python SDK" />
4
+ </project>
.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/DataScienceSalary.iml" filepath="$PROJECT_DIR$/.idea/DataScienceSalary.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
DataScienceSalaries.csv ADDED
The diff for this file is too large to render. See raw diff
 
README.md CHANGED
@@ -1,13 +1,12 @@
1
  ---
2
- title: Salary Estimator
3
- emoji: 🚀
4
- colorFrom: indigo
5
- colorTo: gray
6
  sdk: streamlit
7
- sdk_version: 1.29.0
8
  app_file: app.py
9
  pinned: false
10
- license: apache-2.0
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: DataScienceSalary
3
+ emoji: 🌍
4
+ colorFrom: red
5
+ colorTo: green
6
  sdk: streamlit
7
+ sdk_version: 1.21.0
8
  app_file: app.py
9
  pinned: false
 
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
__pycache__/eda.cpython-39.pyc ADDED
Binary file (4.7 kB). View file
 
__pycache__/prediction.cpython-39.pyc ADDED
Binary file (1.96 kB). View file
 
app.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import eda
3
+ import prediction
4
+
5
+ navigation = st.sidebar.selectbox('Choose Page : ', ('Description','Salary Estimator'))
6
+
7
+ if navigation == 'Description':
8
+ eda.run()
9
+ else:
10
+ prediction.run()
eda.py ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import seaborn as sns
4
+ import matplotlib.pyplot as plt
5
+ import plotly.express as px
6
+ from PIL import Image
7
+ from wordcloud import WordCloud
8
+ from wordcloud import ImageColorGenerator
9
+ from wordcloud import STOPWORDS
10
+
11
+ st.set_page_config(
12
+ page_title='Công cụ ước tính lương nghề khoa học dữ liệu'
13
+ )
14
+
15
+
16
+ def run():
17
+ # Membuat Title
18
+ st.title('Công cụ ước tính lương nghề khoa học dữ liệu')
19
+
20
+ # Sub header
21
+ st.subheader('Mô tả cho công cụ ước tính lương')
22
+
23
+ # Insert Gambar
24
+ image = Image.open('gaji.jpg')
25
+ st.image(image, caption='Lương', use_column_width=True)
26
+
27
+ # description
28
+ st.write('Mục tiêu của công cụ ước tính lương')
29
+ st.write(
30
+ 'Với tư cách là một nhà khoa học dữ liệu, tôi muốn biết liệu tôi có nhận được mức lương xứng đáng từ công ty hay không, vì vậy tôi đã tạo ra mô hình học máy này để dự đoán mức lương cho các công việc trong thế giới dữ liệu.')
31
+ st.write('Tôi hy vọng với công cụ ước tính lương này có thể giúp các bạn biết liệu mình có nhận được mức lương xứng đáng hay không.')
32
+ st.markdown('---')
33
+
34
+ # Menambahkan Deskripsi
35
+ st.write('Trang này được tạo để hiển thị trực quan của tập dữ liệu')
36
+
37
+ st.markdown('---')
38
+
39
+ st.write('Mô tả')
40
+ st.write('Cấp độ kinh nghiệm')
41
+ st.write(
42
+ 'EN, là cấp độ đầu vào. MI, là cấp độ trung bình. SE, cấp độ cao cấp. EX, cấp điều hành.')
43
+
44
+ st.write('Hình thức hợp đồng')
45
+ st.write('FT, tức là Toàn thời gian. PT, tức là Bán thời gian. CT, đó là Hợp đồng. FL, đó là nghề tự do.')
46
+
47
+ st.write('Tỷ lệ làm từ xa')
48
+ st.write('100, hoàn toàn từ xa. 50, là loại kết hợp. 0, là hoàn toàn làm trên công ty.')
49
+
50
+ st.markdown('---')
51
+
52
+ # show dataframe
53
+ data = pd.read_csv('DataScienceSalaries.csv')
54
+ st.dataframe(data)
55
+
56
+ # membuat histogram salary
57
+ st.write('### Biểu đồ lương')
58
+ fig = plt.figure(figsize=(10, 5), dpi=150)
59
+ sns.histplot(data['salary_in_usd'], kde=True, bins=40)
60
+ plt.xlabel('Lương bằng usd', fontsize=15)
61
+ plt.ylabel('Số lượng', fontsize=15)
62
+ plt.title('Biểu đồ lương bằng usd', fontsize=15)
63
+ st.pyplot(fig)
64
+
65
+ # membuat pie chart experience
66
+ st.write('### Biểu đồ phân phối cấp độ kinh nghiệm')
67
+ exp = data.experience_level.value_counts()
68
+
69
+ def make_autopct(values):
70
+ def my_autopct(pct):
71
+ total = sum(values)
72
+ val = int(round(pct * total / 100.0))
73
+ return '{p:.2f}% ({v:d})'.format(p=pct, v=val)
74
+
75
+ return my_autopct
76
+
77
+ fig = plt.figure(figsize=(5, 5), dpi=150)
78
+ exp.plot.pie(autopct=make_autopct(exp))
79
+ plt.title('Biểu đồ phân phối cấp độ kinh nghiệm', fontsize=15)
80
+ st.pyplot(fig)
81
+
82
+ # barchart posisi dengan gaji terbesar
83
+ st.write('### 5 Vị trí có mức lương cao nhất')
84
+ work_rate = data.groupby(['job_title'])['salary_in_usd'].mean()
85
+ work = work_rate.nlargest(5)
86
+ fig = plt.figure(figsize=(15, 5), dpi=150)
87
+ work.plot(kind="bar")
88
+ plt.title('5 Vị trí có mức lương cao nhất', fontsize=15)
89
+ plt.xlabel('Tên vị trí', fontsize=15)
90
+ plt.xticks(rotation=45)
91
+ plt.ylabel('Lương bằng usd', fontsize=15)
92
+ st.pyplot(fig)
93
+
94
+ # negara dengan gaji tertinggi
95
+ st.write('### 5 Quốc gia có mức lương cao nhất')
96
+ location_payrate = data.groupby(['company_location'])['salary_in_usd'].sum()
97
+ lar = location_payrate.nlargest(5)
98
+ fig = plt.figure(figsize=(15, 8), dpi=150)
99
+ lar.plot(kind="bar")
100
+ plt.title('5 Quốc gia có mức lương cao nhất', fontsize=15)
101
+ plt.xlabel('Tên quốc gia', fontsize=15)
102
+ plt.xticks(rotation=0)
103
+ plt.ylabel('Lương bằng usd', fontsize=15)
104
+ st.pyplot(fig)
105
+
106
+ # popular job
107
+ st.write('### Top 10 công việc')
108
+ job = data.groupby(['job_title'])['job_title'].count()
109
+ top_job = job.nlargest(10)
110
+ fig = plt.figure(figsize=(12, 12), dpi=150)
111
+ plt.xticks(rotation=0)
112
+ plt.title("Top 10 công việc", fontsize=15)
113
+ plt.ylabel('Tên công việc', fontsize=15)
114
+ plt.xlabel('Số lượng', fontsize=15)
115
+ sns.barplot(y=top_job.index, x=top_job.values)
116
+ st.pyplot(fig)
117
+
118
+ # wordcloud
119
+ # see most job with word cloud
120
+ text = " ".join(i for i in data.job_title)
121
+ stopwords = set(STOPWORDS)
122
+ wordcloud = WordCloud(width=1600, height=800).generate(text)
123
+ fig = plt.figure(figsize=(15, 10), facecolor='k')
124
+ plt.imshow(wordcloud, interpolation='bilinear')
125
+ plt.axis("off")
126
+ st.pyplot(fig)
127
+
128
+
129
+ if __name__ == '__main__':
130
+ run()
gaji.jpg ADDED
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5c2e808cb0369e96e7d65665dde67791a3e360b4c4b1af3187a4b6f8c9485e19
3
+ size 166331
prediction.py ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import numpy as np
4
+ import pickle
5
+ import json
6
+ import joblib as jb
7
+
8
+ # load models
9
+ model = jb.load('model.pkl')
10
+
11
+ # load data
12
+ df = pd.read_csv('DataScienceSalaries.csv')
13
+
14
+
15
+ def run():
16
+ st.markdown("<h1 style='text-align: center;'>Salary Estimator</h1>", unsafe_allow_html=True)
17
+ # description
18
+
19
+ st.subheader('Vui lòng kiểm tra mức lương của bạn tại đây.')
20
+
21
+ with st.form('key=form_prediction'):
22
+ year = st.selectbox('Năm làm việc', df['work_year'].unique())
23
+ experience = st.selectbox('Cấp độ kinh nghiệm', df['experience_level'].unique())
24
+ employment = st.selectbox('Hình thức hợp đồng', df['employment_type'].unique())
25
+ job = st.selectbox('Vị trí công việc', sorted(df['job_title'].unique()))
26
+ residence = st.selectbox('Quốc tịch', sorted(df['employee_residence'].unique()))
27
+ remote = st.selectbox('Làm việc từ xa', df['remote_ratio'].unique())
28
+ location = st.selectbox('Vị trí công ty', sorted(df['company_location'].unique()))
29
+ size = st.selectbox('Quy mô công ty', df['company_size'].unique())
30
+
31
+ submitted = st.form_submit_button('Dự đoán')
32
+
33
+ inf = {
34
+ 'work_year': year,
35
+ 'experience_level': experience,
36
+ 'employment_type': employment,
37
+ 'job_title': job,
38
+ 'employee_residence': residence,
39
+ 'remote_ratio': remote,
40
+ 'company_location': location,
41
+ 'company_size': size
42
+ }
43
+
44
+ data_inf = pd.DataFrame([inf])
45
+ st.dataframe(data_inf)
46
+
47
+ if submitted:
48
+ # Predict using bagging
49
+ y_pred_inf = model.predict(data_inf)
50
+
51
+ st.write('Với kinh nghiệm này bạn sẽ nhận được mức lương khoảng')
52
+ st.write('# $', str(int(y_pred_inf)))
53
+ st.write(
54
+ 'LƯU Ý: Hãy nhớ rằng mô hình này không chính xác 100%, vui lòng kiểm tra lại với một trang web khác về tiền lương như Glassdoor')
55
+
56
+
57
+ if __name__ == '__main__':
58
+ run()
requirements.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ streamlit
2
+ pandas
3
+ seaborn
4
+ matplotlib
5
+ plotly
6
+ Pillow
7
+ numpy
8
+ WordCloud
9
+ scikit-learn==1.2.2