CoolFace
Apppublic

foovi/TrackingSystem

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes
app.py51 linesDownload Raw Back to root
1import streamlit as st2import google.generativeai as genai3import PyPDF2 as pdf4from dotenv import load_dotenv5import os6 7load_dotenv()  8 9genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))10 11def get_gemini_response(input):12    model = genai.GenerativeModel('gemini-pro')13    response = model.generate_content(input)14    return response.text15 16# Function to convert PDF to text17def input_pdf_text(uploaded_file):18    reader = pdf.PdfReader(uploaded_file)19    text = ""20    for page in reader.pages:21        text += page.extract_text()22    return text23 24# Prompt Template25input_prompt = """26You are an experienced Technical Human Resource Manager. Your task is to review the provided resume against the job description. 27Please share your professional evaluation on whether the candidate's profile aligns with the role. Assess the strengths and weaknesses of the applicant in relation to the specified job requirements.28Assign a percentage matching score based on the job description and identify any missing keywords.29resume: {text}30description: {jd}31 32I want the response in one single string having the structure:33{{"JD Percentage Match":"%","Missing Keywords from resume:[]","Profile Summary and analysis":""}}34"""35 36## Streamlit app37st.title("Smart Application Tracking System Ver2.0")38st.text("Resume Analyzer App")39jd = st.text_area("Insert the job description here:")40uploaded_file = st.file_uploader("Upload Your Resume", type="pdf", help="Please upload the PDF")41 42submit = st.button("Submit")43 44if submit:45    if uploaded_file is not None:46        text = input_pdf_text(uploaded_file)47        prompt = input_prompt.format(text=text, jd=jd)48        response = get_gemini_response(prompt)49        st.subheader("Analysis Result:")50        st.json(response)51