Spaces:
Build error
Build error
Download app.py from vmalapaka/Resume_Screening: direct link, hf CLI and curl.
- Browser
- Download file 2.43 kB
-
https://huggingface.co/spaces/vmalapaka/Resume_Screening/resolve/main/app.py
- Command line
-
hf download hf://spaces/vmalapaka/Resume_Screening/app.py
-
curl -L -o app.py https://huggingface.co/spaces/vmalapaka/Resume_Screening/resolve/main/app.py
2.43 kB
| import streamlit as st | |
| from dotenv import load_dotenv | |
| from utils import * | |
| import uuid | |
| 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 Assistant") | |
| st.title("HR - Resume Screening Assistant ") | |
| job_description = st.text_area("Paste the Job description here",key="1") | |
| document_count = st.text_input("No.of resumes to return",key="2") | |
| pdf = st.file_uploader("Upload resumes here, only PDF format allowed", type=["pdf"],accept_multiple_files=True) | |
| submit=st.button("Submit") | |
| if submit: | |
| with st.spinner('Loading...'): | |
| #Creating a unique ID, so that we can use to query and get only the user uploaded documents from PINECONE vector store | |
| st.session_state['unique_id']=uuid.uuid4().hex | |
| #Create a documents list out of all the user uploaded pdf files | |
| final_docs_list=create_docs(pdf,st.session_state['unique_id']) | |
| #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("50b78f61-9dee-49b1-af4e-131a7f73ccdc","us-east-1","resume",embeddings,final_docs_list) | |
| #Fecth relavant documents from PINECONE | |
| relavant_docs=similar_docs(job_description,document_count,"50b78f61-9dee-49b1-af4e-131a7f73ccdc","us-east-1","resume",embeddings,st.session_state['unique_id']) | |
| #For each item in relavant docs - we are displaying some info of it on the UI | |
| 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 more'): | |
| st.info("Match Score : "+str(relavant_docs[item][1])) | |
| #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) | |
| if __name__ == '__main__': | |
| main() | |