Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,11 +3,9 @@ import PyPDF2
|
|
3 |
import google.generativeai as genai
|
4 |
import os
|
5 |
|
6 |
-
# Initialize Gemini Flash model with your API key
|
7 |
genai.configure(api_key=os.environ.get("Google_API_KEY"))
|
8 |
model = genai.GenerativeModel('gemini-1.5-flash')
|
9 |
|
10 |
-
# Function to extract text from uploaded PDF
|
11 |
def extract_text_from_pdf(pdf_file):
|
12 |
reader = PyPDF2.PdfReader(pdf_file)
|
13 |
text = ''
|
@@ -16,12 +14,11 @@ def extract_text_from_pdf(pdf_file):
|
|
16 |
text += page.extract_text()
|
17 |
return text
|
18 |
|
19 |
-
# Function to process the CV and job description
|
20 |
def check_cv_match(cv_text, job_description):
|
21 |
prompt = (
|
22 |
f"You are an AI expert assisting with recruitment. "
|
23 |
f"Compare the following resume with the job description and determine if the resume matches the job requirements. "
|
24 |
-
f"Provide a
|
25 |
f"Job Description: {job_description}\n\n"
|
26 |
f"Resume: {cv_text}\n\n"
|
27 |
f"Give a score from 0% to 100% indicating how well the resume matches the job."
|
@@ -36,11 +33,10 @@ st.title("CV and Job Description Matcher")
|
|
36 |
uploaded_cv = st.file_uploader("Upload CV (PDF format)", type="pdf")
|
37 |
|
38 |
if uploaded_cv is not None:
|
39 |
-
# Extract text from uploaded PDF
|
40 |
cv_text = extract_text_from_pdf(uploaded_cv)
|
41 |
st.text_area("Extracted CV Text", value=cv_text, height=300)
|
42 |
|
43 |
-
|
44 |
job_description = st.text_area("Enter the Job Description", height=300)
|
45 |
|
46 |
if st.button("Check Match"):
|
|
|
3 |
import google.generativeai as genai
|
4 |
import os
|
5 |
|
|
|
6 |
genai.configure(api_key=os.environ.get("Google_API_KEY"))
|
7 |
model = genai.GenerativeModel('gemini-1.5-flash')
|
8 |
|
|
|
9 |
def extract_text_from_pdf(pdf_file):
|
10 |
reader = PyPDF2.PdfReader(pdf_file)
|
11 |
text = ''
|
|
|
14 |
text += page.extract_text()
|
15 |
return text
|
16 |
|
|
|
17 |
def check_cv_match(cv_text, job_description):
|
18 |
prompt = (
|
19 |
f"You are an AI expert assisting with recruitment. "
|
20 |
f"Compare the following resume with the job description and determine if the resume matches the job requirements. "
|
21 |
+
f"Provide a brief analysis and a match percentage:\n\n"
|
22 |
f"Job Description: {job_description}\n\n"
|
23 |
f"Resume: {cv_text}\n\n"
|
24 |
f"Give a score from 0% to 100% indicating how well the resume matches the job."
|
|
|
33 |
uploaded_cv = st.file_uploader("Upload CV (PDF format)", type="pdf")
|
34 |
|
35 |
if uploaded_cv is not None:
|
|
|
36 |
cv_text = extract_text_from_pdf(uploaded_cv)
|
37 |
st.text_area("Extracted CV Text", value=cv_text, height=300)
|
38 |
|
39 |
+
|
40 |
job_description = st.text_area("Enter the Job Description", height=300)
|
41 |
|
42 |
if st.button("Check Match"):
|