Aashi/Application-Tracking-System
2
1import streamlit as st2import os 3import io 4import base645from PIL import Image6import pdf2image 7import google.generativeai as genai 8 9genai.configure(api_key = os.getenv('GEN_AI_API_KEY'))10 11def get_gemini_response(input, pdf_content, prompt):12 model.genai.GenerativeModel('gemini-pro-vision')13 response = model.generate_content([input, pdf_content[0], prompt])14 return response.text15 16def input_pdf_setup(uploaded_file):17 if uploaded_file is not None:18 ## convert pdf to image19 images = pdf2image.convert_from_bytes(uploaded_file.read())20 first_page = images[0]21 # take image and convert into bytes22 img_byte_arr = io.BytesIO()23 first_page.save(img_byte_arr, format = 'JPEG')24 img_byte_arr = img_byte_arr.getvalue()25 26 pdf_parts = [27 {28 "mime-type": "image/jpeg",29 "data": base64.b64encode(img_byte_arr).decode()30 }31 ]32 return pdf_parts33 else:34 raise FileNotFoundError("No File uploaded")35 36 37# Streamlit app38st.set_page_config(page_title = "ATS Resume Analyser")39st.header("ATS Tracker")40input_text = st.text_area("Job Description: ", key = "input")41uploaded_file = st.file_uploader("Upload your resume in pdf format...", type = ["pdf"])42 43if uploaded_file is not None:44 st.write("PDF uploaded successfully ")45 46submit1 = st.button("Tell me about the resume")47# submit2 = st.button("How can I improve my skills")48# submit3 = st.button("What are the missing keywords in my resume")49submit3 = st.button("Percentage match to Job description")50 51input_prompt1 = """52You are an experienced Technical Human Resource Manager with tech experience with experience in data science, LLMs, 53machine learning, deep learning, devops and data analyst,54your task is to review the provided resume and share your professional evaluation on 55whether the candidate's profile aligns with the Job description. Highlight the strengths and weakness of the applicant56in relation to the specified job description57 58"""59input_prompt3 = """60You are skilled ATS (Application Tracking System) scanner with a deep understanding of any one job role data science, LLMs, 61machine learning, deep learning, devops, data analyst and deep ATS functionality. Your task is to evaluate the given resume against provided job description62Give me a percentage match if the resume matches the job description and should come as a percentage followed by keywords missing in the resume.63 64"""65if submit1:66 if uploaded_file is not None:67 pdf_content = input_pdf_setup(uploaded_file)68 response = get_gemini_response(input_text, pdf_content, input_prompt1)69 st.subheader("The response is: ")70 st.write(response)71 else:72 st.write("Please upload the resume")73 74elif submit3:75 if uploaded_file is not None:76 pdf_content = input_pdf_setup(uploaded_file)77 response = get_gemini_response(input_text, pdf_content,input_prompt3)78 st.subheader("The response is: ")79 st.write(response)80 else:81 st.write("Please upload the resume")82 83 84 