import streamlit as st from dotenv import load_dotenv from utils import * import uuid from langchain_community.vectorstores import FAISS from langchain_chroma import Chroma import pandas as pd st.set_page_config(page_title="Resume Screening Assistance", layout="wide") custom_html = """

HR Resume Copilot ... πŸ’

""" # Render the custom HTML st.markdown(custom_html, unsafe_allow_html=True) #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.title("HR - Resume Screening AssistanceπŸ’") st.subheader("I can help you in resume screening process") # Upload the Job Description (pdf files) job_description = st.file_uploader("JOB DESCRIPTION", type=["pdf"]) # Upload the Resumes (pdf files) pdf = st.file_uploader("RESUME", type=["pdf"],accept_multiple_files=True) #document retrun count document_count = st.text_input("No.of 'RESUMES' to return",key="2") #submit button submit = st.button("Help me with the analysis") if submit: with st.spinner('Wait for it...'): #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() #using faiss db db = Chroma.from_documents(final_docs_list, embeddings) job_description_txt = get_pdf_text(job_description) #using faiss db for similarity search with similarity score relavant_docs = db.similarity_search_with_relevance_scores(job_description_txt,k=int(document_count)) data = [] #For each item in relavant docs - we are displaying some info of it on the UI for item in pdf: # st.subheader("πŸ‘‰ "+str(item+1)) resume_txt = get_pdf_text(item) # #Displaying Filepath # document_object = final_docs_list[item][0] # file_name = document_object.metadata.get('name', None) finel_name = item.name # st.write("**File** : "+str(finel_name)) #Introducing Expander feature with st.expander('Show me πŸ‘€'): # st.info("**Matched Vector Score** : "+str(relavant_docs[item][1])) matched_result = opeani_response(resume_txt, job_description_txt) matched_percentage, reason, skills_to_improve, keywords, irrelevant = get_strip_response(matched_result) #Gets the summary of the current item using 'get_summary' function that we have created which uses LLM & Langchain chain summary = get_summary(resume_txt) # Append the information to the DataFrame data.append([finel_name, matched_percentage, reason, skills_to_improve, keywords, irrelevant, summary]) table_data = pd.DataFrame(data, columns=["File", "Matched Score", "Matched Reason" , "Skills to improve", "Keywords", "Irrelevant", "Summary"]) # Sort the DataFrame based on the 'Matched Score' column in descending order df_sorted = table_data.sort_values(by='Matched Score', ascending=False) # Reset the index df_sorted.reset_index(drop=True, inplace=True) # Loop through each row and print in the specified format for index, row in df_sorted.iterrows(): st.write("**File** : "+row["File"]) st.info("**Matched Score πŸ’―** : " + str(row["Matched Score"]) + "%") st.write("**Matched Reason 🌟** : " + row["Matched Reason"]) st.write("**Skills to improve 🎯** : " + row["Skills to improve"]) st.write("**Keywords πŸ—οΈ** : " + row["Keywords"]) st.write("**Irrelevant πŸ“›** : " + row["Irrelevant"]) st.write("**Summary πŸ“œ** : " + row["Summary"]) st.write("## Relevant Documents") st.table(df_sorted) # graph = ploty_graph(matched_percentage_dict) # st.plotly_chart(graph) csv = df_sorted.to_csv().encode('utf-8') st.download_button( label="Download data as CSV", data=csv, file_name='Result Data.csv', mime='text/csv', ) st.success("Hope I was able to save your time❀️") #Invoking main function if __name__ == '__main__': main()