Rahul-Sainy commited on
Commit
d6d2c1f
·
verified ·
1 Parent(s): 96ed76b

back to orginal form git

Browse files
Files changed (1) hide show
  1. app.py +12 -10
app.py CHANGED
@@ -4,29 +4,28 @@ import os
4
  from PyPDF2 import PdfReader
5
  import json
6
  from dotenv import load_dotenv
7
-
8
  load_dotenv()
9
 
10
  genai.configure(api_key=os.getenv('Google_API_KEY'))
11
 
12
- input_prompt = """
13
  Hey Act Like a skilled or very experience ATS(Application Tracking System)
14
  with a deep understanding of tech field,software engineering,data science ,data analyst
15
  and big data engineer. Your task is to evaluate the resume based on the given job description.
16
  You must consider the job market is very competitive and you should provide
17
- best assistance for improving the resumes. Assign the percentage Matching based
18
  on Jd and
19
  the missing keywords with high accuracy
20
  resume:{text}
21
  description:{jd}
 
22
  I want the response in one single string having the structure
23
- {{"JD Match":"%","MissingKeywords":[],"Profile Summary":""}}
24
  """
25
-
26
  def get_gemini_response(input):
27
  model = genai.GenerativeModel('gemini-pro')
28
  response = model.generate_content(input)
29
- return json.dumps(response.dict(), ensure_ascii=False)
30
 
31
  def input_pdf_text(uploaded_file):
32
  reader = PdfReader(uploaded_file)
@@ -35,6 +34,8 @@ def input_pdf_text(uploaded_file):
35
  text += str(page.extract_text())
36
  return text
37
 
 
 
38
  # Set page configuration
39
  st.set_page_config(
40
  page_title="Resume ATS Tracking",
@@ -42,11 +43,9 @@ st.set_page_config(
42
  layout="wide",
43
  initial_sidebar_state="expanded",
44
  )
45
-
46
  sidebar = st.sidebar
47
  sidebar.title('Navigation')
48
  sidebar.markdown('Use this panel to navigate through the application and input your data.')
49
-
50
  # Add a title and a subtitle
51
  st.title('Resume ATS Tracking')
52
  st.subheader('Upload your resume and paste the job description to get the ATS tracking response')
@@ -60,8 +59,11 @@ submit = st.button('Submit')
60
  if submit:
61
  if uploaded_file is not None:
62
  text = input_pdf_text(uploaded_file)
63
- input = input_prompt.format(text=text, jd=jd)
64
- response = get_gemini_response(input)
 
 
 
65
  response_dict = json.loads(response)
66
 
67
  # Display the response in a structured way
 
4
  from PyPDF2 import PdfReader
5
  import json
6
  from dotenv import load_dotenv
 
7
  load_dotenv()
8
 
9
  genai.configure(api_key=os.getenv('Google_API_KEY'))
10
 
11
+ input_prompt="""
12
  Hey Act Like a skilled or very experience ATS(Application Tracking System)
13
  with a deep understanding of tech field,software engineering,data science ,data analyst
14
  and big data engineer. Your task is to evaluate the resume based on the given job description.
15
  You must consider the job market is very competitive and you should provide
16
+ best assistance for improving thr resumes. Assign the percentage Matching based
17
  on Jd and
18
  the missing keywords with high accuracy
19
  resume:{text}
20
  description:{jd}
21
+
22
  I want the response in one single string having the structure
23
+ {{"JD Match":"%","MissingKeywords:[]","Profile Summary":""}}
24
  """
 
25
  def get_gemini_response(input):
26
  model = genai.GenerativeModel('gemini-pro')
27
  response = model.generate_content(input)
28
+ return response.text
29
 
30
  def input_pdf_text(uploaded_file):
31
  reader = PdfReader(uploaded_file)
 
34
  text += str(page.extract_text())
35
  return text
36
 
37
+
38
+
39
  # Set page configuration
40
  st.set_page_config(
41
  page_title="Resume ATS Tracking",
 
43
  layout="wide",
44
  initial_sidebar_state="expanded",
45
  )
 
46
  sidebar = st.sidebar
47
  sidebar.title('Navigation')
48
  sidebar.markdown('Use this panel to navigate through the application and input your data.')
 
49
  # Add a title and a subtitle
50
  st.title('Resume ATS Tracking')
51
  st.subheader('Upload your resume and paste the job description to get the ATS tracking response')
 
59
  if submit:
60
  if uploaded_file is not None:
61
  text = input_pdf_text(uploaded_file)
62
+ # input = input_prompt.format(text=text,jd=jd)
63
+ response = get_gemini_response(input_prompt)
64
+ response = response[1:-1]
65
+
66
+ # Convert the response to a dictionary
67
  response_dict = json.loads(response)
68
 
69
  # Display the response in a structured way