Papireddy commited on
Commit
d20782d
1 Parent(s): 1ec633d

Upload 6 files

Browse files
Files changed (6) hide show
  1. ATS_score.py +17 -0
  2. app.py +69 -0
  3. convert.py +35 -0
  4. job_description.txt +39 -0
  5. model.py +22 -0
  6. requirements.txt +4 -0
ATS_score.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #find ats score
2
+ from sklearn.feature_extraction.text import TfidfVectorizer
3
+ from sklearn.metrics.pairwise import cosine_similarity
4
+ from sklearn.feature_extraction import _stop_words
5
+ from convert import ExtractPDFText
6
+
7
+ def calculateATSscore(resume_data, job_description):
8
+ stopwords = list(_stop_words.ENGLISH_STOP_WORDS)
9
+ vectorizer = TfidfVectorizer(stop_words=stopwords)
10
+ vectors = vectorizer.fit_transform([job_description, resume_data])
11
+ similarity_value = cosine_similarity(vectors)
12
+ print(similarity_value)
13
+ # return similarity_value[0,1]
14
+ return similarity_value[0,1]
15
+
16
+
17
+
app.py ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Import necessary libraries
2
+ from convert import ExtractPDFText
3
+ from ATS_score import calculateATSscore
4
+ from model import modelFeedback
5
+ import streamlit as st
6
+ import time
7
+
8
+
9
+ if "page_number" not in st.session_state:
10
+ st.session_state.page_number = 1
11
+
12
+ if "resume_data" not in st.session_state:
13
+ st.session_state.resume_data = ""
14
+
15
+ if "jobdescription" not in st.session_state:
16
+ st.session_state.jobdescription = ""
17
+
18
+ def page1():
19
+ st.title("AI-Powered ATS Screening")
20
+ if not st.session_state.resume_data:
21
+ pdf = st.file_uploader(label="Upload your resume", type="pdf")
22
+ st.write("No Resume Yet? Create one [here](https://www.overleaf.com/latex/templates/tagged/cv)")
23
+
24
+ if pdf:
25
+ st.success("Resume uploaded successfully.")
26
+ st.session_state.resume_data = ExtractPDFText(pdf)
27
+
28
+ def page2():
29
+ st.title("AI-Powered ATS Screening: Job Description")
30
+ st.session_state.jobdescription = st.text_area("Job Description: ")
31
+ st.info("You can just copy paste from the job portal")
32
+ submit = st.button("Submit")
33
+
34
+ if submit:
35
+ start()
36
+
37
+ def page3():
38
+ st.title("Your Resume data: ")
39
+ if st.session_state.resume_data:
40
+ st.write(st.session_state.resume_data)
41
+ else:
42
+ st.error("Please upload your resume to view the extracted data")
43
+
44
+ def start():
45
+ if st.session_state.resume_data and st.session_state.jobdescription:
46
+ with st.spinner("Hold on, we're calculating your ATS Score..."):
47
+ ATS_score = calculateATSscore(st.session_state.resume_data, st.session_state.jobdescription)
48
+ model_feedback = modelFeedback(ATS_score, st.session_state.resume_data)
49
+ time.sleep(10)
50
+
51
+
52
+ st.subheader("AI FEEDBACK:")
53
+ st.write(model_feedback.text)
54
+ st.session_state.resume_data = ""
55
+ else:
56
+ st.info("Please, upload Resume and Provide the Job Description")
57
+
58
+ if st.session_state.page_number == 1:
59
+ page1()
60
+ elif st.session_state.page_number == 2:
61
+ page2()
62
+ elif st.session_state.page_number == 3:
63
+ page3()
64
+
65
+ if st.session_state.page_number == 1:
66
+ st.button("View your Extracted Resume data", on_click = lambda: setattr(st.session_state,"page_number", 3))
67
+ st.button("Go to Job Description Page", on_click=lambda: setattr(st.session_state, "page_number", 2))
68
+ else:
69
+ st.button("Go to PDF Upload Page", on_click=lambda: setattr(st.session_state, "page_number", 1))
convert.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import fitz
2
+ from io import BytesIO
3
+ import streamlit as st
4
+
5
+ def ExtractPDFText(pdf):
6
+ content = ""
7
+ pdf_bytes = pdf.read()
8
+
9
+ try:
10
+ # Open the PDF using fitz
11
+ pdf_document = fitz.open("dummy.pdf", pdf_bytes)
12
+
13
+ # Iterate through pages and extract text
14
+ for page_number in range(pdf_document.page_count):
15
+ page = pdf_document[page_number]
16
+ text = page.get_text()
17
+ content += text
18
+
19
+ except Exception as e:
20
+ st.error(f"Error extracting text from PDF: {e}")
21
+
22
+ finally:
23
+ # Close the PDF document
24
+ if "pdf_document" in locals():
25
+ pdf_document.close()
26
+
27
+ return content
28
+
29
+ # Example usage in Streamlit app
30
+ pdf = st.file_uploader("Upload a PDF file", type=["pdf"])
31
+
32
+ if pdf:
33
+ text_content = ExtractPDFText(pdf)
34
+ st.write("PDF Content:")
35
+ # st.write(text_content)
job_description.txt ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Job Title: Data Scientist
2
+ Company: XYZ Corporation
3
+ Location: Mountain View, CA (for illustrative purposes only)
4
+
5
+ Job Overview:
6
+
7
+ XYZ Corporation is seeking a highly skilled and motivated Data Scientist to join our dynamic team. As a Data Scientist, you will play a key role in extracting valuable insights from our vast datasets to drive informed decision-making and contribute to the company's success. This role involves leveraging advanced analytics and machine learning techniques to solve complex business problems.
8
+
9
+ Responsibilities:
10
+
11
+ Develop and implement machine learning models for predictive and prescriptive analytics.
12
+ Analyze large datasets to identify trends, patterns, and correlations that can inform business strategies.
13
+ Collaborate with cross-functional teams to understand business requirements and provide data-driven solutions.
14
+ Design and implement experiments to validate hypotheses and improve model performance.
15
+ Stay abreast of the latest developments in data science, machine learning, and industry best practices.
16
+ Present findings and insights to both technical and non-technical stakeholders in a clear and concise manner.
17
+ Ensure the quality, reliability, and integrity of data used for analysis.
18
+ Qualifications:
19
+
20
+ Master's or Ph.D. in a quantitative field such as Computer Science, Statistics, or related discipline.
21
+ Proven experience as a Data Scientist with a strong track record of successfully applying machine learning techniques to real-world problems.
22
+ Proficiency in programming languages such as Python or R.
23
+ Solid understanding of statistical concepts and techniques.
24
+ Strong analytical and problem-solving skills.
25
+ Excellent communication and collaboration skills.
26
+ Preferred Skills:
27
+
28
+ Experience with big data technologies such as Hadoop, Spark, or similar.
29
+ Knowledge of cloud computing platforms (e.g., Google Cloud, AWS, Azure).
30
+ Familiarity with deep learning frameworks (e.g., TensorFlow, PyTorch).
31
+ Previous experience in the tech industry.
32
+ Benefits:
33
+
34
+ Competitive salary and performance-based bonuses.
35
+ Comprehensive health, dental, and vision insurance.
36
+ 401(k) retirement plan.
37
+ Professional development opportunities.
38
+ Flexible work hours and remote work options.
39
+ This is just a generic example, and actual job descriptions may vary. It's important to carefully read and understand the specific requirements and expectations outlined in the job postings of the companies you are interested in.
model.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import google.generativeai as genai
2
+ import os
3
+ from dotenv import load_dotenv
4
+ from convert import ExtractPDFText
5
+ load_dotenv()
6
+
7
+ genai.configure(api_key = os.environ["GOOGLE_API_KEY"])
8
+
9
+ model = genai.GenerativeModel("gemini-pro")
10
+
11
+ def modelFeedback(ats_score,resume_data):
12
+
13
+ input_prompt = f"""
14
+ You are now an ATS Score analyzer and given ATS Score is {ats_score}.
15
+ Your task is to provide feedback to the user based on the ATS score.
16
+ print ATS score first. mention where resume is good and where resume lacks.
17
+ talk about the resume like one to one chat.
18
+ """
19
+ response = model.generate_content([input_prompt,resume_data],stream=True)
20
+ response.resolve()
21
+
22
+ return response
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ pymupdf
2
+ scikit-learn
3
+ google.generativeai
4
+ streamlit