Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import google.generativeai as genai
|
| 3 |
+
import os
|
| 4 |
+
import PyPDF2 as pdf
|
| 5 |
+
from dotenv import load_dotenv
|
| 6 |
+
import json
|
| 7 |
+
|
| 8 |
+
load_dotenv() ## load all our environment variables
|
| 9 |
+
|
| 10 |
+
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
| 11 |
+
|
| 12 |
+
# Gemini Pro Response
|
| 13 |
+
def get_gemini_repsonse(input):
|
| 14 |
+
# Assigning the Model
|
| 15 |
+
model=genai.GenerativeModel('gemini-pro')
|
| 16 |
+
response=model.generate_content(input)
|
| 17 |
+
return response.text
|
| 18 |
+
|
| 19 |
+
# Extract and concatenate text from all pages of the given PDF file
|
| 20 |
+
def input_pdf_text(uploaded_file):
|
| 21 |
+
reader=pdf.PdfReader(uploaded_file)
|
| 22 |
+
text=""
|
| 23 |
+
# Iterate through all the pages
|
| 24 |
+
for page in range(len(reader.pages)):
|
| 25 |
+
page=reader.pages[page]
|
| 26 |
+
# Extracting the text
|
| 27 |
+
text+=str(page.extract_text())
|
| 28 |
+
return text
|
| 29 |
+
|
| 30 |
+
#Prompt Template --> The Better the prompt better is the result
|
| 31 |
+
input_prompt="""
|
| 32 |
+
Hey Act Like a skilled or very experienced ATS(Application Tracking System) with a deep understanding of the tech field, software engineering, data science, data analysis and big data engineering. Your task is to evaluate the resume based on the given job description.
|
| 33 |
+
You must consider the job market is very competitive and you should provide the best assistance for improving the resumes. Assign the percentage Matching based on the Job description and the missing keywords with high accuracy.
|
| 34 |
+
resume:{text}
|
| 35 |
+
description:{jd}
|
| 36 |
+
|
| 37 |
+
I want the response in one single string having the structure
|
| 38 |
+
{{"JD Match":"%","MissingKeywords:[]","Profile Summary":""}}
|
| 39 |
+
"""
|
| 40 |
+
|
| 41 |
+
## Creating the Streamlit App
|
| 42 |
+
st.title("Smart ATS")
|
| 43 |
+
st.text("Improve Your Resume ATS")
|
| 44 |
+
jd=st.text_area("Paste the Job Description")
|
| 45 |
+
uploaded_file=st.file_uploader("Upload Your Resume",type="pdf",help="Please uplaod the pdf")
|
| 46 |
+
|
| 47 |
+
submit = st.button("Submit")
|
| 48 |
+
|
| 49 |
+
if submit:
|
| 50 |
+
if uploaded_file is not None:
|
| 51 |
+
text=input_pdf_text(uploaded_file)
|
| 52 |
+
response=get_gemini_repsonse(input_prompt)
|
| 53 |
+
st.subheader(response)
|