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