Spaces:
Sleeping
Sleeping
import streamlit as st | |
import utils as u | |
import uuid | |
if 'unique_id' not in st.session_state: | |
st.session_state['unique_id'] = '' | |
if 'PINECONE_API_KEY' not in st.session_state: | |
st.session_state['PINECONE_API_KEY'] = '' | |
def main(): | |
st.set_page_config(page_title="Resume Screening Assistance") | |
st.title("HR - Resume Screening Assistance...π ") | |
st.subheader("I can help you in resume screening process") | |
st.sidebar.title("πποΈ") | |
st.session_state['PINECONE_API_KEY']= st.sidebar.text_input("What's your Pinecone API key?",type="password") | |
job_description = st.text_area("Please paste JOB DESCRIPTION here...", key='1') | |
document_count = st.text_input("Number of RESUMES to return", key='2') | |
pdf = st.file_uploader("Upload resumes HERE, only pdfs allowed", type=['pdf'],accept_multiple_files=True) | |
submit = st.button("Help me with the analysis") | |
if submit: | |
if not st.session_state['PINECONE_API_KEY']: st.error("Please input Pinecone API KEY") | |
with st.spinner("Waiting to fetch resumes..."): | |
st.session_state['unique_id'] = uuid.uuid4().hex | |
final_docs_list = u.create_docs(pdf, st.session_state['unique_id']) | |
st.write("*Resumes uploaded* :"+str(len(final_docs_list))) | |
embedder = u.initiate_embedder() | |
index = u.push_to_pinecone(st.session_state['PINECONE_API_KEY'], 'resume-screener',embedder,final_docs_list) | |
relevant_docs = u.get_similar_docs(st.session_state['PINECONE_API_KEY'], 'resume-screener',embedder,job_description,st.session_state['unique_id'], document_count,) | |
st.write(":heavy_minus_sign:" * 30) | |
for item in range(len(relevant_docs)): | |
st.subheader("π "+str(item+1)) | |
st.write("**File** : "+relevant_docs[item][0].metadata['name']) | |
with st.expander('Show me π'): | |
st.info("**Match Score** : "+str(relevant_docs[item][1])) | |
summary = u.get_summary(relevant_docs[item][0]) | |
st.write("**Summary** : "+summary) | |
st.success('Hope I was able to save your time!!') | |
if __name__ == '__main__': | |
main() | |