import os import io import streamlit as st import pdf2image import google.generativeai as genai import base64 from PIL import Image from dotenv import load_dotenv from time import sleep # Load environment variables load_dotenv() # Configure generative AI genai.configure(api_key=os.getenv("GOOGLE_API_KEY")) # Function to generate a response using generative AI def get_gemini_response(input, pdf_content, prompt): model = genai.GenerativeModel("gemini-1.5-flash") response = model.generate_content([input, pdf_content[0], prompt]) return response.text # Function to process uploaded PDF and extract content def input_pdf_setup(uploaded_file): if uploaded_file is not None: images = pdf2image.convert_from_bytes(uploaded_file.read()) first_page = images[0] img_byte_arr = io.BytesIO() first_page.save(img_byte_arr, format='JPEG') img_byte_arr = img_byte_arr.getvalue() pdf_parts = [ { "mime_type": "image/jpeg", "data": base64.b64encode(img_byte_arr).decode() } ] return pdf_parts else: raise FileNotFoundError("No File Uploaded") # Prompts for Generative AI input_prompt1 = """ You are an experienced HR with Technical Experience in the field of any one job role from Data Science, Data Analyst, DevOPS, Machine Learning Engineer, Prompt Engineer, AI Engineer, Full Stack Web Development, Big Data Engineering, Marketing Analyst, Human Resource Manager, Software Developer your task is to review the provided resume against the job description for these profiles. Please share your professional evaluation on whether the candidate's profile aligns with the role. Highlight the strengths and weaknesses of the applicant in relation to the specified job requirements. """ input_prompt2 = """ You are an skilled ATS (Applicant Tracking System) scanner with a deep understanding of any one job role from Data Science, Data Analyst, DevOPS, Machine Learning Engineer, Prompt Engineering, AI Engineer, Full Stack Web Development, Big Data Engineering, Marketing Analyst, Human Resource Manager, Software Developer and deep ATS functionality, your task is to evaluate the resume against the provided job description, give me only the Percentage of match if the resume matches the job description. First the output should come as Percentage and then list of Keywords Missing and last final thoughts. """ # Set STREAMLIT page configuration st.set_page_config( page_title="Application Tracking System", page_icon="📝", layout="wide", initial_sidebar_state="collapsed" ) # Add custom CSS and animations st.markdown(""" """, unsafe_allow_html=True) # Main title st.markdown("
Analyze & Optimize your Resume for top job opportunities with AI insights
", unsafe_allow_html=True) st.markdown("