Spaces:
Sleeping
Sleeping
Create resume_analysis.py
Browse files- resume_analysis.py +44 -0
resume_analysis.py
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# resume_analysis.py
|
2 |
+
|
3 |
+
import streamlit as st
|
4 |
+
import fitz # PyMuPDF
|
5 |
+
|
6 |
+
def resume_analysis_page():
|
7 |
+
st.header("Resume Analysis and Optimization")
|
8 |
+
|
9 |
+
uploaded_file = st.file_uploader("Upload your resume (PDF format):", type="pdf")
|
10 |
+
|
11 |
+
if uploaded_file:
|
12 |
+
resume_text = extract_text_from_pdf(uploaded_file)
|
13 |
+
if resume_text:
|
14 |
+
st.success("Resume uploaded successfully!")
|
15 |
+
# Perform analysis
|
16 |
+
st.subheader("Extracted Information")
|
17 |
+
# Extracted data display
|
18 |
+
# For example, display extracted skills
|
19 |
+
skills = extract_skills(resume_text)
|
20 |
+
st.write("**Skills:**", ', '.join(skills))
|
21 |
+
# Provide optimization suggestions
|
22 |
+
st.subheader("Optimization Suggestions")
|
23 |
+
# Display suggestions
|
24 |
+
st.write("- Consider adding more industry-specific keywords.")
|
25 |
+
st.write("- Reformat your work experience for clarity.")
|
26 |
+
else:
|
27 |
+
st.error("Failed to extract text from resume.")
|
28 |
+
|
29 |
+
def extract_text_from_pdf(pdf_file):
|
30 |
+
text = ""
|
31 |
+
try:
|
32 |
+
with fitz.open(stream=pdf_file.read(), filetype="pdf") as doc:
|
33 |
+
for page in doc:
|
34 |
+
text += page.get_text()
|
35 |
+
return text
|
36 |
+
except Exception as e:
|
37 |
+
st.error(f"Error extracting text: {e}")
|
38 |
+
return ""
|
39 |
+
|
40 |
+
def extract_skills(text):
|
41 |
+
# Implement skill extraction logic
|
42 |
+
skills_list = ["Python", "Machine Learning", "Data Analysis", "SQL", "Communication", "Leadership"]
|
43 |
+
extracted_skills = [skill for skill in skills_list if skill.lower() in text.lower()]
|
44 |
+
return extracted_skills
|