import os from dotenv import load_dotenv import streamlit as st import google.generativeai as genai from PyPDF2 import PdfReader ## load the environment variables load_dotenv() ## configure the google with apikey genai.configure(api_key=os.getenv('GOOGLE_API_KEY')) #to get response from geminipro def get_response_gemini(input): model=genai.GenerativeModel('gemini-pro') response=model.generate_content(input) return response.text ## to read pdf data to text def read_pdf_text(uploaded_file): if uploaded_file is not None: reader=PdfReader(uploaded_file) text = '' for page_num in range(len(reader.pages)): page = reader.pages[page_num] text += page.extract_text() return text # for creating prompt template with dynamic input fields input_prompt=[""" You are an expert hr in Applicant Tracking System (ATS) for a resume application. The ATS is specialized in handling resumes for candidates with expertise in full-stack development, DevOps, data science, and data analytics. Inputs: {text}: This input represents the resume of a candidate applying for a job. {jd}: This input represents the job description provided by the employer. Objective: Design a system that can analyze the resume text and the job description to determine the extent to which the candidate's skills match the requirements of the job. The system should utilize natural language processing techniques to identify relevant skills and experience related to full-stack development, DevOps, data science, and data analytics. Assign the matching score with respect to the job description and give the missing words Guidelines: Consider using keyword matching, named entity recognition, or other NLP techniques to identify relevant skills and experience in both the resume text and the job description. Assign weights or scores to different skills and experiences based on their relevance to the job requirements. Provide a summary or ranking of the candidate's suitability for the job based on the analysis of the resume text and the job description. Output: The system output should be in the form of below 1. a summary of the candidate's suitability for the job, highlighting the match between the candidate's skills and experiences and the requirements of the job. 2. {{JD Matching Score:'%'}} 3. {{Missing Keywords:[]}} """] ## Streamlit app st.set_page_config(page_title="ATS APP for Resumes") st.header('ATS using Gemini Pro') jd=st.text_area('Enter the job description: ',key='jd') upload_file=st.file_uploader('Upload resume: ',type='pdf') submit=st.button('Validate') if submit: if upload_file is not None: text=read_pdf_text(upload_file) response=get_response_gemini(input_prompt) st.subheader(response) else: st.subheader('Please upload the resume')