funnyPhani commited on
Commit
5d9885c
·
verified ·
1 Parent(s): bf24140

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +56 -66
app.py CHANGED
@@ -1,88 +1,78 @@
 
 
 
 
 
1
  import os
2
  import PyPDF2 as pdf
3
  import streamlit as st
4
  from dotenv import load_dotenv
5
  import google.generativeai as genai
 
6
 
7
- # Load the environment variables
8
  load_dotenv()
9
- genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
10
- model = genai.GenerativeModel('gemini-1.5-flash-latest')
 
11
 
12
  st.set_page_config(page_title="Smart Application Tracking System", page_icon=":robot:")
13
 
14
- # page_bg_img = f"""
15
- # <style>
16
- # [data-testid="stAppViewContainer"] > .main {{
17
- # background-image: url("https://e0.pxfuel.com/wallpapers/219/656/desktop-wallpaper-purple-color-background-best-for-your-mobile-tablet-explore-color-cool-color-colored-background-one-color-aesthetic-one-color.jpg");
18
- # background-size: 180%;
19
- # background-position: top left;
20
- # background-repeat: no-repeat;
21
- # background-attachment: local;
22
- # }}
23
-
24
- # [data-testid="stHeader"] {{
25
- # background: rgba(0,0,0,0);
26
- # }}
27
-
28
- # [data-testid="stToolbar"] {{
29
- # right: 2rem;
30
- # }}
31
- # </style>
32
- # """
33
 
34
- # st.markdown(page_bg_img, unsafe_allow_html=True)
 
 
 
 
35
 
 
36
 
 
 
 
 
 
 
 
37
 
38
- ## streamlit app
39
- st.title("SMART APPLICATION TRACKING SYSTEM")
40
- st.text("Improve Your Resume ATS Score")
41
- jd=st.text_area("Paste the Job Description")
42
- uploaded_file=st.file_uploader("Upload Your Resume",type="pdf",help="Please uplaod the pdf")
43
 
44
  submit = st.button("Submit")
45
 
46
  if submit:
47
- if uploaded_file is not None:
48
- reader=pdf.PdfReader(uploaded_file)
49
- extracted_text=""
 
50
  for page in range(len(reader.pages)):
51
- page=reader.pages[page]
52
- extracted_text+=str(page.extract_text())
53
- #Prompt Template
54
- input_prompt=f"""
55
- You are an advanced Applicant Tracking System (ATS) with deep expertise in the fields of software engineering, data science, data analysis, and big data engineering. Your primary task is to meticulously evaluate the provided resume against the given job description. The evaluation must account for the highly competitive job market, and you should offer valuable insights for improving the resume's relevance to the job description.
56
-
57
- Your response should focus on the following three areas:
58
-
59
- 1. **Job Description Match:**
60
- Provide a percentage match score based on how well the resume aligns with the job description. This score should consider the candidate's skills, experience, and qualifications in relation to the job requirements.
61
-
62
- 2. **Missing Keywords:**
63
- Identify and list the key terms and phrases from the job description that are missing from the resume. Highlight those that are critical to the job and may significantly impact the resume's match score.
64
-
65
- 3. **Profile Summary:**
66
- Create a concise and impactful profile summary based on the information extracted from the resume. The summary should highlight the candidate's most relevant skills, experience, and achievements in a manner that aligns with the job description.
67
-
68
- Resume: {extracted_text}
69
- Job Description: {jd}
70
- """
71
-
72
- # input_prompt=f"""
73
- # You are a skilled and very experience ATS(Application Tracking System) with a deep understanding of tech field,software engineering,
74
- # data science ,data analyst, and big data engineer. Your task is to evaluate the resume based on the given job description.
75
- # You must consider the job market is very competitive and you should provide best assistance for improving thr resumes.
76
- # Assign the percentage Matching based on Job description and the missing keywords with high accuracy
77
- # Resume:{extracted_text}
78
- # Description:{jd}
79
-
80
- # I want the only response in 3 sectors as follows:
81
- # • Job Description Match: \n
82
- # • MissingKeywords: \n
83
- # • Profile Summary: should be based on the {extracted_text} in short and concise manner.\n
84
- # """
85
- response = model.generate_content(input_prompt)
86
  st.write(response.text)
 
 
 
87
 
88
 
 
1
+ #
2
+
3
+
4
+
5
+
6
  import os
7
  import PyPDF2 as pdf
8
  import streamlit as st
9
  from dotenv import load_dotenv
10
  import google.generativeai as genai
11
+ from PIL import Image
12
 
13
+ # Load environment variables
14
  load_dotenv()
15
+ GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
16
+ genai.configure(api_key=GOOGLE_API_KEY)
17
+ model = genai.GenerativeModel(model_name='gemini-1.5-flash')
18
 
19
  st.set_page_config(page_title="Smart Application Tracking System", page_icon=":robot:")
20
 
21
+ st.title("SMART APPLICATION TRACKING SYSTEM")
22
+ st.text("Improve Your Resume ATS Score")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
+ # Job description input
25
+ jd_option = st.radio(
26
+ "How would you like to provide the Job Description?",
27
+ ("Text Input", "Upload Image")
28
+ )
29
 
30
+ jd = None
31
 
32
+ if jd_option == "Text Input":
33
+ jd = st.text_area("Paste the Job Description")
34
+ else:
35
+ jd_image = st.file_uploader("Upload Job Description Image", type=["png", "jpg", "jpeg"], help="Please upload the job description image.")
36
+ if jd_image is not None:
37
+ jd_image_opened = Image.open(jd_image)
38
+ jd = jd_image_opened # Assuming that the API can handle image input directly
39
 
40
+ # Resume upload
41
+ uploaded_file = st.file_uploader("Upload Your Resume", type="pdf", help="Please upload the PDF")
 
 
 
42
 
43
  submit = st.button("Submit")
44
 
45
  if submit:
46
+ if uploaded_file is not None and jd is not None:
47
+ # Extract text from the PDF resume
48
+ reader = pdf.PdfReader(uploaded_file)
49
+ extracted_text = ""
50
  for page in range(len(reader.pages)):
51
+ page = reader.pages[page]
52
+ extracted_text += str(page.extract_text())
53
+
54
+ # Create the prompt
55
+ input_prompt = f"""
56
+ You are an advanced Applicant Tracking System (ATS) with deep expertise in the fields of software engineering, data science, data analysis, and big data engineering. Your primary task is to meticulously evaluate the provided resume against the given job description. The evaluation must account for the highly competitive job market, and you should offer valuable insights for improving the resume's relevance to the job description.
57
+ Your response should focus on the following three areas:
58
+ 1. **Job Description Match:**
59
+ Provide a percentage match score based on how well the resume aligns with the job description. This score should consider the candidate's skills, experience, and qualifications in relation to the job requirements.
60
+ 2. **Missing Keywords:**
61
+ Identify and list the key terms and phrases from the job description that are missing from the resume. Highlight those that are critical to the job and may significantly impact the resume's match score.
62
+ 3. **Profile Summary:**
63
+ Create a concise and impactful profile summary based on the information extracted from the resume. The summary should highlight the candidate's most relevant skills, experience, and achievements in a manner that aligns with the job description.
64
+ Resume: {extracted_text}
65
+ Job Description: {jd if isinstance(jd, str) else "Job Description Image"}
66
+ """
67
+
68
+ if isinstance(jd, str):
69
+ response = model.generate_content([input_prompt])
70
+ else:
71
+ response = model.generate_content([input_prompt, jd])
72
+
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  st.write(response.text)
74
+ else:
75
+ st.error("Please upload both a resume and a job description.")
76
+
77
 
78