Elvan Selvano commited on
Commit
8b89a72
β€’
1 Parent(s): 059d601

Add common categories

Browse files
Files changed (1) hide show
  1. app.py +39 -1
app.py CHANGED
@@ -112,6 +112,11 @@ def show_heading():
112
  ''', unsafe_allow_html=True)
113
  st.write('This app lets you search and sort talent by job title or relevant job descriptions from ecommurz talent list in real-time.')
114
 
 
 
 
 
 
115
  def main():
116
  """Main Function"""
117
  show_heading()
@@ -121,11 +126,44 @@ def main():
121
  data = load_dataset(columns)
122
  model = load_model()
123
  corpus_embeddings = create_embedding(model, data, 'Previous Role')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
 
125
  job_title = st.text_input('Insert the job title below:', '')
126
  submitted = st.button('Submit')
127
 
128
- if submitted:
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  print(job_title + ',' + str(pd.Timestamp.now()))
130
  st.info(f'Showing most similar results for {job_title}...')
131
  result = get_similarity_score(model, data, job_title, corpus_embeddings)
 
112
  ''', unsafe_allow_html=True)
113
  st.write('This app lets you search and sort talent by job title or relevant job descriptions from ecommurz talent list in real-time.')
114
 
115
+ def get_specific_category(model, data, category, corpus_embeddings):
116
+ """Get specific category with confidence score > 0.45"""
117
+ data = get_similarity_score(model, data, category, corpus_embeddings)
118
+ return data[data['score'] > 0.45].shape[0]
119
+
120
  def main():
121
  """Main Function"""
122
  show_heading()
 
126
  data = load_dataset(columns)
127
  model = load_model()
128
  corpus_embeddings = create_embedding(model, data, 'Previous Role')
129
+ col1, col2, col3, col4, col5, col6, _, _, _, _ = st.columns(10)
130
+
131
+ with col1:
132
+ data_count = get_specific_category(model, data, 'data', corpus_embeddings)
133
+ data_bt = st.button(f'Data ({data_count})')
134
+ with col2:
135
+ finance_count = get_specific_category(model, data, 'finance', corpus_embeddings)
136
+ finance_bt = st.button(f'Finance ({finance_count})')
137
+ with col3:
138
+ marketing_count = get_specific_category(model, data, 'marketing', corpus_embeddings)
139
+ marketing_bt = st.button(f'Marketing ({marketing_count})')
140
+ with col4:
141
+ social_media_count = get_specific_category(model, data, 'social media', corpus_embeddings)
142
+ social_media_bt = st.button(f'Social Media ({social_media_count})')
143
+ with col5:
144
+ arts_design_count = get_specific_category(model, data, 'design and creative', corpus_embeddings)
145
+ arts_design_bt = st.button(f'Arts & Design ({arts_design_count})')
146
+ with col6:
147
+ computer_count = get_specific_category(model, data, 'engineer', corpus_embeddings)
148
+ computer_bt = st.button(f'Computer Science ({computer_count})')
149
 
150
  job_title = st.text_input('Insert the job title below:', '')
151
  submitted = st.button('Submit')
152
 
153
+ if data_bt:
154
+ job_title = 'data'
155
+ if finance_bt:
156
+ job_title = 'finance'
157
+ if marketing_bt:
158
+ job_title = 'marketing'
159
+ if social_media_bt:
160
+ job_title = 'social media'
161
+ if arts_design_bt:
162
+ job_title = 'design and creative'
163
+ if computer_bt:
164
+ job_title = 'engineer and developer'
165
+
166
+ if submitted or data_bt or finance_bt or marketing_bt or social_media_bt or arts_design_bt or computer_bt:
167
  print(job_title + ',' + str(pd.Timestamp.now()))
168
  st.info(f'Showing most similar results for {job_title}...')
169
  result = get_similarity_score(model, data, job_title, corpus_embeddings)