Spaces:
Runtime error
Runtime error
Download app.py from iamchris1688/ResumeScreening: direct link, hf CLI and curl.
- Browser
- Download file 3.53 kB
-
https://huggingface.co/spaces/iamchris1688/ResumeScreening/resolve/main/app.py
- Command line
-
hf download hf://spaces/iamchris1688/ResumeScreening/app.py
-
curl -L -o app.py https://huggingface.co/spaces/iamchris1688/ResumeScreening/resolve/main/app.py
3.53 kB
| import streamlit as st | |
| from dotenv import load_dotenv | |
| from utils import * | |
| import uuid | |
| #Creating session variables | |
| if 'unique_id' not in st.session_state: | |
| st.session_state['unique_id'] ='' | |
| def main(): | |
| load_dotenv() | |
| st.set_page_config(page_title="Resume Screening Assistance") | |
| st.header("ATS • Resume Screening Assistance") | |
| st.write("Using AI, recruiters save hours to easily find resumes closest matched to job decription.") | |
| st.write("Chain 1: sentence-transformers/all-MiniLM-L6-v2 for embedding") | |
| st.write("Chain 2: openAI for doc summarization") | |
| st.write("Vector DB: pinecone") | |
| st.write("") | |
| job_description = st.text_area("Step 1: Paste the JOB DESCRIPTION here.",height=200, key="1") | |
| document_count = st.text_input("Step 2: Select NUMBER OF RESUMES to return. ",key="2") | |
| # Upload the Resumes (pdf files) | |
| pdf = st.file_uploader("Step 3: Upload resumes here. PDF only.", type=["pdf"],accept_multiple_files=True) | |
| submit=st.button("Find me top resumes") | |
| if submit: | |
| with st.spinner('Analyzing...'): | |
| #Creating a unique ID, so that we can use to query and get only the user uploaded documents from PINECONE vector store | |
| unique_uuid = uuid.uuid4().hex | |
| # st.session_state['unique_id']=unique_uuid | |
| # print("st.session_state['unique_id']: ", unique_uuid) | |
| print("unique_uuid: ", unique_uuid) | |
| print("job_description: ", job_description) | |
| print("document_count: ", document_count) | |
| #Create a documents list out of all the user uploaded pdf files | |
| final_docs_list=create_docs(pdf, unique_uuid) | |
| #Displaying the count of resumes that have been uploaded | |
| st.write("• Resumes uploaded :"+str(len(final_docs_list))) | |
| #Create embeddings instance | |
| embeddings=create_embeddings_load_data() | |
| #Push data to PINECONE | |
| push_to_pinecone("23fd6fd1-744d-4500-a77c-4944591a53f9","gcp-starter","resume-screening",embeddings,final_docs_list) | |
| #Fecth relavant documents from PINECONE | |
| relavant_docs=similar_docs(job_description,document_count,"23fd6fd1-744d-4500-a77c-4944591a53f9","gcp-starter","resume-screening",embeddings,unique_uuid) | |
| #t.write(relavant_docs) | |
| #Introducing a line separator | |
| st.write(":heavy_minus_sign:" * 30) | |
| #For each item in relavant docs - we are displaying some info of it on the UI | |
| print('>>>> RELEVANT DOCUMENTS: ' + str(len(relavant_docs))) | |
| for item in range(len(relavant_docs)): | |
| st.subheader("👉 "+str(item+1)) | |
| #Displaying Filepath | |
| st.write("• File: "+relavant_docs[item][0].metadata['name']) | |
| #Introducing Expander feature | |
| with st.expander('Show me summary: 👀'): | |
| st.info("• Match Score: " + str(relavant_docs[item][1])) | |
| # print(relavant_docs[item]) | |
| #st.write("***"+relavant_docs[item][0].page_content) | |
| #Gets the summary of the current item using 'get_summary' function that we have created which uses LLM & Langchain chain | |
| summary = get_summary(relavant_docs[item][0]) | |
| st.write("• Summary: "+summary) | |
| st.success("Analyze Complete. ") | |
| #Invoking main function | |
| if __name__ == '__main__': | |
| main() | |