File size: 1,622 Bytes
03f6b50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# resume_analysis.py

import streamlit as st
import fitz  # PyMuPDF

def resume_analysis_page():
    st.header("Resume Analysis and Optimization")

    uploaded_file = st.file_uploader("Upload your resume (PDF format):", type="pdf")

    if uploaded_file:
        resume_text = extract_text_from_pdf(uploaded_file)
        if resume_text:
            st.success("Resume uploaded successfully!")
            # Perform analysis
            st.subheader("Extracted Information")
            # Extracted data display
            # For example, display extracted skills
            skills = extract_skills(resume_text)
            st.write("**Skills:**", ', '.join(skills))
            # Provide optimization suggestions
            st.subheader("Optimization Suggestions")
            # Display suggestions
            st.write("- Consider adding more industry-specific keywords.")
            st.write("- Reformat your work experience for clarity.")
        else:
            st.error("Failed to extract text from resume.")

def extract_text_from_pdf(pdf_file):
    text = ""
    try:
        with fitz.open(stream=pdf_file.read(), filetype="pdf") as doc:
            for page in doc:
                text += page.get_text()
        return text
    except Exception as e:
        st.error(f"Error extracting text: {e}")
        return ""

def extract_skills(text):
    # Implement skill extraction logic
    skills_list = ["Python", "Machine Learning", "Data Analysis", "SQL", "Communication", "Leadership"]
    extracted_skills = [skill for skill in skills_list if skill.lower() in text.lower()]
    return extracted_skills