CoolFace
Apppublic

chelscelis/resume-screening-classification

sourceHugging Faceupdated 3y agoView on Hugging Face
3likes
app.py120 linesDownload Raw Back to root
1import pandas as pd2import streamlit as st 3 4from utils import *5 6backgroundPattern = """7<style>8[data-testid="stAppViewContainer"] {9    background-color: #0E1117;10    opacity: 1;11    background-image: radial-gradient(#282C34 0.75px, #0E1117 0.75px);12    background-size: 15px 15px;13}14</style>15"""16 17# backgroundPattern = """18# <style>19# [data-testid="stAppViewContainer"] {20#     background-color: #FFFFFF;21#     opacity: 1;22#     background-image: radial-gradient(#D1D1D1 0.75px, #FFFFFF 0.75px);23#     background-size: 15px 15px;24# }25# </style>26# """27 28st.markdown(backgroundPattern, unsafe_allow_html=True)29 30st.write("""31# Resume Screening & Classification32""")33st.caption("""34Using K-Nearest Neighbors (KNN) algorithm and Cosine Similarity35######36""")37 38tab1, tab2, tab3 = st.tabs(['Getting Started', 'Classify', 'Rank'])39 40with tab1:41    writeGettingStarted()42 43with tab2:44    st.header('Input')45    uploadedResumeClf = st.file_uploader('Upload Resumes', type = 'xlsx', key = 'upload-resume-clf')46 47    if uploadedResumeClf is not None:48        isButtonDisabledClf = False49    else:50        st.session_state.processClf = False 51        isButtonDisabledClf = True52 53    if 'processClf' not in st.session_state:54        st.session_state.processClf = False55 56    st.button('Start Processing', on_click = clickClassify, disabled = isButtonDisabledClf, key = 'process-clf')57 58    if st.session_state.processClf:59        st.divider()60        st.header('Output')61        resumeClf = pd.read_excel(uploadedResumeClf)62        63        if 'Resume' in resumeClf.columns:64            resumeClf = classifyResumes(resumeClf)65            with st.expander('View Bar Chart'):66                barChart = createBarChart(resumeClf)67                st.altair_chart(barChart, use_container_width = True)68            currentClf = filterDataframeClf(resumeClf)69            st.dataframe(currentClf, use_container_width = True, hide_index = True)70            xlsxClf = convertDfToXlsx(currentClf)71            st.download_button(label='Save Current Output as XLSX', data = xlsxClf, file_name = 'Resumes_categorized.xlsx')72        else:73            st.error("""74            #### Oops! Something went wrong.75 76            The **"Resume"** column is not found in the uploaded excel file.77            78            Kindly make sure the column is present :)79            """)80 81with tab3:82    st.header('Input')83    uploadedJobDescriptionRnk = st.file_uploader('Upload Job Description', type = 'txt', key = 'upload-jd-rnk')84    uploadedResumeRnk = st.file_uploader('Upload Resumes', type = 'xlsx', key = 'upload-resume-rnk')85 86    if all([uploadedJobDescriptionRnk, uploadedResumeRnk]):87        isButtonDisabledRnk = False88    else:89        st.session_state.processRank = False90        isButtonDisabledRnk = True91 92    if 'processRank' not in st.session_state:93        st.session_state.processRank = False94 95    st.button('Start Processing', on_click = clickRank, disabled = isButtonDisabledRnk, key = 'process-rnk')96 97    if st.session_state.processRank:98        st.divider()99        st.header('Output')100        jobDescriptionRnk = uploadedJobDescriptionRnk.read().decode('utf-8')101        resumeRnk = pd.read_excel(uploadedResumeRnk)102 103        if 'Resume' in resumeRnk.columns:104            resumeRnk = rankResumes(jobDescriptionRnk, resumeRnk)105            with st.expander('View Job Description'):106                st.write(jobDescriptionRnk)107            currentRnk = filterDataframeRnk(resumeRnk)108            st.dataframe(currentRnk, use_container_width = True, hide_index = True)109            xlsxRnk = convertDfToXlsx(currentRnk)110            st.download_button(label='Save Current Output as XLSX', data = xlsxRnk, file_name = 'Resumes_ranked.xlsx')111        else:112            st.error("""113            #### Oops! Something went wrong.114 115            The **"Resume"** column is not found in the uploaded excel file.116            117            Kindly make sure the column is present :)118            """)119 120