Download app.py from ashwinncj/profiler: direct link, hf CLI and curl.
- Browser
- Download file 2.41 kB
-
https://huggingface.co/spaces/ashwinncj/profiler/resolve/main/app.py
- Command line
-
hf download hf://spaces/ashwinncj/profiler/app.py
-
curl -L -o app.py https://huggingface.co/spaces/ashwinncj/profiler/resolve/main/app.py
2.41 kB
| # streamlit app | |
| import streamlit as st | |
| # Use a pipeline as a high-level helper | |
| from transformers import pipeline | |
| st.header('Profiler App') | |
| input = st.text_area("Enter proile information", height=100) | |
| summary_btn = st.button("Summarize") | |
| if summary_btn: | |
| with st.spinner('Summarizing...'): | |
| summarizer = pipeline("summarization", model="facebook/bart-large-cnn") | |
| st.subheader('Candidate Summary') | |
| summary = summarizer(input) | |
| st.write(summary[0]['summary_text']) | |
| st.subheader('Desired Skills') | |
| skills = st.multiselect('Skills', ['Python', 'Java', 'C++', 'C#', 'Javascript', 'SQL', 'HTML', 'CSS', 'PHP', 'Ruby', 'R', 'Swift', 'Objective-C', 'Kotlin', 'Go', 'Scala', 'Perl', | |
| 'wordpress', 'Drupal', 'Joomla', 'Laravel', 'Symfony', 'Wordpress', 'Joomla', 'Drupal', 'Laravel', 'Symfony', 'Wordpress', 'Joomla', 'Drupal', 'Laravel', 'Symfony', 'Word', | |
| 'blockchain', 'Ethereum', 'Bitcoin', 'NFT', 'Blockchain', 'Ethereum', 'Bitcoin', 'NFT', 'Blockchain', 'Ethereum', 'Bitcoin', 'NFT', 'Blockchain', 'Ethereum', 'Bitcoin', 'NFT', 'Blockchain']) | |
| skills_btn = st.button("Classify") | |
| if skills_btn: | |
| # check if atleast one skill is selected | |
| if len(skills) == 0: | |
| st.error('Please select atleast one skill') | |
| st.stop() | |
| st.subheader('Candidate Classification') | |
| with st.spinner('Classifying...'): | |
| classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli") | |
| result = classifier(input, skills) | |
| # Arrange the skills in the desending order of scores | |
| result['scores'] = sorted(result['scores'], reverse=True) | |
| # print the skills in the order of scores | |
| st.write("Skills in order of scores:") | |
| # for i=0 to n of labels, print the skill and the score corresponding to same index. Use progress bar | |
| for i in range(len(result['labels'])): | |
| st.write(f"{result['labels'][i]}: {result['scores'][i]}") | |
| st.progress(result['scores'][i]) | |
| st.write(result) | |
| # foreach of the skills, check if it is in the result, if yes, print it along with scores | |
| for skill in skills: | |
| if skill in result['labels']: | |
| st.write(f"{skill}: {result['scores'][result['labels'].index(skill)]}") | |
| else: | |
| st.write(f"{skill}: 0") | |