Spaces:
Sleeping
Sleeping
from dotenv import load_dotenv | |
from langchain.prompts import PromptTemplate | |
load_dotenv() | |
from PyPDF2 import PdfReader | |
import streamlit as st | |
import os | |
import google.generativeai as genai | |
import re | |
# genai.configure(api_key=os.getenv("gkey2")) | |
import PIL.Image | |
import pdf2image | |
###approach###### | |
# 1.pdf-->image->api-->response [ats_1.0] | |
# 2.pdf-->text-->api-->response [ats_2.0] | |
def get_pdf_text(pdf_doc): | |
text="" | |
pdf_reader=PdfReader(pdf_doc) | |
for page in pdf_reader.pages: | |
text+=page.extract_text() | |
return text | |
model=genai.GenerativeModel('gemini-pro') | |
def get_gemini_response(input): | |
response=model.generate_content(input) | |
return response.text | |
def prompt_temp(text,jd): | |
input_prompt= [ | |
f""" | |
Hey Act Like a skilled or very experience ATS(Application Tracking System) | |
with a deep understanding of tech field,software engineering,data science ,data analyst | |
and big data engineer. Your task is to evaluate the resume based on the given job description. | |
You must consider the job market is very competitive and you should provide | |
best assistance for improving thr resumes. Assign the percentage Matching based | |
on Jd and | |
the missing keywords with high accuracy | |
resume:{text} | |
description:{jd} | |
I want the response in one single string having the structure | |
{{"JD Match":"%",'\n' "MissingKeywords:[]",'\n' "Profile Summary":""}} | |
"""] | |
return input_prompt | |
st.title("Smart ATS") | |
st.text("Improve Your Resume ATS") | |
jd=st.text_area("Paste the Job Description") | |
uploaded_file=st.file_uploader("Upload Your Resume",type="pdf",help="Please uplaod the pdf") | |
submit = st.button("Submit") | |
if submit: | |
if uploaded_file is not None: | |
text=get_pdf_text(uploaded_file) | |
input_prompt=prompt_temp(text,jd) | |
response=get_gemini_response(input_prompt) | |
st.write(response) |