Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,6 @@ import os
|
|
| 4 |
from PyPDF2 import PdfReader
|
| 5 |
import google.generativeai as genai
|
| 6 |
from dotenv import load_dotenv
|
| 7 |
-
import docx
|
| 8 |
|
| 9 |
# Loading the .env keys
|
| 10 |
load_dotenv()
|
|
@@ -23,38 +22,38 @@ def get_pdf_text(pdf_docs):
|
|
| 23 |
for page in pdf_reader.pages:
|
| 24 |
text += page.extract_text()
|
| 25 |
elif doc.name.endswith(".docx"):
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
return text
|
| 30 |
|
| 31 |
# Define input prompts
|
| 32 |
input_prompts = {
|
| 33 |
"evaluate_resume": """
|
| 34 |
-
You are an experienced Technical Human Resource Manager
|
| 35 |
Please share your professional evaluation on whether the candidate's profile aligns with the role.
|
| 36 |
Highlight the strengths and weaknesses of the applicant in relation to the specified job requirements.
|
| 37 |
-
|
| 38 |
""",
|
| 39 |
"improve_skills": """
|
| 40 |
-
You are
|
| 41 |
-
|
| 42 |
Share your insights on the candidate's suitability for the role from an HR perspective.
|
| 43 |
Additionally, offer advice on enhancing the candidate's skills and identify areas where improvement is needed.
|
| 44 |
-
|
| 45 |
""",
|
| 46 |
"missing_keywords": """
|
| 47 |
-
You are
|
| 48 |
-
|
| 49 |
-
assess the compatibility of the resume with the role.
|
| 50 |
-
Also, provide recommendations for enhancing the candidate's skills and
|
| 51 |
-
|
| 52 |
""",
|
| 53 |
"percentage_match": """
|
| 54 |
-
You are
|
| 55 |
-
|
| 56 |
-
the job description. First
|
| 57 |
-
|
| 58 |
""",
|
| 59 |
"answer_query": """
|
| 60 |
You are an experienced Technical Human Resource Manager. Please answer the following query based on the resume and job description provided.
|
|
@@ -63,14 +62,10 @@ input_prompts = {
|
|
| 63 |
|
| 64 |
# Define model options
|
| 65 |
model_options = [
|
| 66 |
-
"
|
| 67 |
-
"
|
| 68 |
-
"
|
| 69 |
-
"
|
| 70 |
-
"models/gemini-1.5-flash-latest",
|
| 71 |
-
"models/gemini-1.5-pro-latest",
|
| 72 |
-
"models/gemini-pro",
|
| 73 |
-
"models/gemini-pro-vision"
|
| 74 |
]
|
| 75 |
|
| 76 |
# Streamlit App
|
|
|
|
| 4 |
from PyPDF2 import PdfReader
|
| 5 |
import google.generativeai as genai
|
| 6 |
from dotenv import load_dotenv
|
|
|
|
| 7 |
|
| 8 |
# Loading the .env keys
|
| 9 |
load_dotenv()
|
|
|
|
| 22 |
for page in pdf_reader.pages:
|
| 23 |
text += page.extract_text()
|
| 24 |
elif doc.name.endswith(".docx"):
|
| 25 |
+
try:
|
| 26 |
+
import docx
|
| 27 |
+
doc_reader = docx.Document(doc)
|
| 28 |
+
for para in doc_reader.paragraphs:
|
| 29 |
+
text += para.text + "\n"
|
| 30 |
+
except ImportError:
|
| 31 |
+
st.error("Please make sure you have installed the `python-docx` package.")
|
| 32 |
return text
|
| 33 |
|
| 34 |
# Define input prompts
|
| 35 |
input_prompts = {
|
| 36 |
"evaluate_resume": """
|
| 37 |
+
You are an experienced Technical Human Resource Manager,your task is to review the provided resume against the job description.
|
| 38 |
Please share your professional evaluation on whether the candidate's profile aligns with the role.
|
| 39 |
Highlight the strengths and weaknesses of the applicant in relation to the specified job requirements.
|
|
|
|
| 40 |
""",
|
| 41 |
"improve_skills": """
|
| 42 |
+
You are an Technical Human Resource Manager with expertise in data science,
|
| 43 |
+
your role is to scrutinize the resume in light of the job description provided.
|
| 44 |
Share your insights on the candidate's suitability for the role from an HR perspective.
|
| 45 |
Additionally, offer advice on enhancing the candidate's skills and identify areas where improvement is needed.
|
|
|
|
| 46 |
""",
|
| 47 |
"missing_keywords": """
|
| 48 |
+
You are an skilled ATS (Applicant Tracking System) scanner with a deep understanding of data science and ATS functionality,
|
| 49 |
+
your task is to evaluate the resume against the provided job description. As a Human Resource manager,
|
| 50 |
+
assess the compatibility of the resume with the role. Give me what are the keywords that are missing
|
| 51 |
+
Also, provide recommendations for enhancing the candidate's skills and identify which areas require further development.
|
|
|
|
| 52 |
""",
|
| 53 |
"percentage_match": """
|
| 54 |
+
You are an skilled ATS (Applicant Tracking System) scanner with a deep understanding of data science and ATS functionality,
|
| 55 |
+
your task is to evaluate the resume against the provided job description. give me the percentage of match if the resume matches
|
| 56 |
+
the job description. First the output should come as percentage and then keywords missing and last final thoughts.
|
|
|
|
| 57 |
""",
|
| 58 |
"answer_query": """
|
| 59 |
You are an experienced Technical Human Resource Manager. Please answer the following query based on the resume and job description provided.
|
|
|
|
| 62 |
|
| 63 |
# Define model options
|
| 64 |
model_options = [
|
| 65 |
+
"gemini-1.5-flash",
|
| 66 |
+
"gemini-1.5-pro",
|
| 67 |
+
"gemini-1.0-pro",
|
| 68 |
+
"gemini-pro"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
]
|
| 70 |
|
| 71 |
# Streamlit App
|