Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| from sentence_transformers.util import cos_sim | |
| from sentence_transformers import models, SentenceTransformer,util | |
| import pandas as pd | |
| skills=['leading and motivating', | |
| 'supervising people', | |
| 'organising, planning and scheduling work and activities', | |
| 'protecting and enforcing', | |
| 'monitoring, inspecting and testing', | |
| 'counselling', | |
| 'using hand tools', | |
| 'using digital tools for collaboration, content creation and problem solving', | |
| 'teaching and training', | |
| 'negotiating', | |
| 'conducting studies, investigations and examinations', | |
| 'handling and disposing of waste and hazardous materials', | |
| 'developing objectives and strategies', | |
| 'thinking creatively and innovatively', | |
| 'working with others', | |
| 'analysing and evaluating information and data', | |
| 'installing interior or exterior infrastructure', | |
| 'designing systems and products', | |
| 'moving and lifting', | |
| 'advising and consulting', | |
| 'operating machinery for the manufacture of products', | |
| 'handling animals', | |
| 'setting up and protecting computer systems', | |
| 'providing information and support to the public and clients', | |
| 'writing and composing', | |
| 'assembling and fabricating products', | |
| 'operating mobile plant', | |
| 'sorting and packaging goods and materials', | |
| 'promoting, selling and purchasing', | |
| 'providing health care or medical treatments', | |
| 'documenting and recording information', | |
| 'managing information', | |
| 'accessing and analysing digital data', | |
| 'preparing and serving food and drinks', | |
| 'installing, maintaining and repairing mechanical equipment', | |
| 'installing, maintaining and repairing electrical, electronic and precision equipment', | |
| 'working with machinery and specialised equipment', | |
| 'driving vehicles', | |
| 'providing general personal care', | |
| 'transforming and blending materials', | |
| 'allocating and controlling resources', | |
| 'liaising and networking', | |
| 'performing and entertaining', | |
| 'performing administrative activities', | |
| 'monitoring developments in area of expertise', | |
| 'tending plants and crops', | |
| 'creating artistic, visual or instructive materials', | |
| 'building and repairing structures', | |
| 'processing information', | |
| 'using precision instrumentation and equipment', | |
| 'calculating and estimating', | |
| 'obtaining information verbally', | |
| 'presenting information', | |
| 'making moulds, casts, models and patterns', | |
| 'processing information, ideas and concepts', | |
| 'making decisions', | |
| 'dealing with problems', | |
| 'solving problems', | |
| 'measuring physical properties', | |
| 'operating watercraft', | |
| 'management skills', | |
| 'positioning materials, tools or equipment', | |
| 'washing and maintaining textiles and clothing', | |
| 'operating machinery for the extraction and processing of raw materials', | |
| 'working with computers', | |
| 'information skills', | |
| 'cleaning', | |
| 'finishing interior or exterior of structures', | |
| 'communication, collaboration and creativity', | |
| 'constructing', | |
| 'operating aircraft', | |
| 'programming computer systems', | |
| 'working in teams and collaboration', | |
| 'using digital tools to control machinery', | |
| 'assisting and caring', | |
| 'using more than one language', | |
| 'recruiting and hiring', | |
| 'planning and organising', | |
| 'handling and moving'] | |
| #mpnet_fine_tuned = SentenceTransformer('content/mpnet') | |
| sbert_model = SentenceTransformer('h3lmi/fine_tuned_minilm12') | |
| from sentence_transformers.util import cos_sim | |
| def test(sentence,model,top_k=5): | |
| sims=[] | |
| skill_embeddings=model.encode(skills) | |
| query_vec=model.encode(sentence) | |
| hits = util.semantic_search(query_vec, skill_embeddings, top_k=top_k)[0] | |
| for hit in hits[0:top_k]: | |
| sims.append({'Skill': skills[hit['corpus_id']] ,'similarity': hit['score']}) | |
| return pd.DataFrame(sims) | |
| st.title('Activity/Skill Semantic Matching') | |
| search = st.text_input('Enter Activity/Skill') | |
| if search: | |
| st.dataframe(test(search,sbert_model,5)) | |