File size: 2,708 Bytes
5d842b8
bbd468a
 
 
41b2d80
bbd468a
 
 
 
 
 
 
41b2d80
5d842b8
bbd468a
 
41b2d80
bbd468a
41b2d80
a937656
bbd468a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import streamlit as st
import base64
import os
import tempfile
from utils import (
    parse_cv,
    identify_field_with_llm,
    generate_skill_score,
    generate_llm_suggestions,
    get_live_jobs,
    generate_counselor_response,
    generate_pdf_report
)

st.set_page_config(page_title="Smart CV Analyzer", layout="wide")
st.title("πŸ“„ Universal Smart CV Analyzer & Career Roadmap")

uploaded_file = st.file_uploader("Upload your CV (PDF format)", type=["pdf"])

if uploaded_file:
    with st.spinner("Parsing CV..."):
        with tempfile.NamedTemporaryFile(delete=False) as tmp_file:
            tmp_file.write(uploaded_file.read())
            tmp_path = tmp_file.name

        raw_text = parse_cv(tmp_path)
        os.unlink(tmp_path)

        st.subheader("🧠 CV Extracted Text")
        st.text_area("Extracted CV Content", raw_text, height=250)

        with st.spinner("πŸ” Identifying field/domain..."):
            field = identify_field_with_llm(raw_text)
            st.success(f"Detected Field: {field}")

        with st.spinner("πŸ“Š Generating Skill Score..."):
            score = generate_skill_score(raw_text)
            st.metric("Skill Score (0–100)", score)

        with st.spinner("🧠 Generating AI-based suggestions..."):
            suggestions = generate_llm_suggestions(raw_text, field)

        st.subheader("πŸ“Œ Career Suggestions")
        st.markdown(f"**Upskilling Skills:** {', '.join(suggestions['skills'])}")
        st.markdown(f"**Certifications:** {', '.join(suggestions['certifications'])}")
        st.markdown(f"**Scholarships:** {', '.join(suggestions['scholarships'])}")
        st.markdown(f"**Education Opportunities:** {', '.join(suggestions['education'])}")
        st.markdown(f"**Visa Pathways:** {', '.join(suggestions['visa'])}")

        with st.spinner("🌍 Finding live jobs..."):
            jobs = get_live_jobs(field)
            st.subheader("πŸ’Ό Live Job Opportunities")
            for job in jobs:
                st.markdown(f"- **[{job['title']}]({job['url']})** at *{job['company']}* ({job['location']})")

        st.subheader("πŸ§‘β€πŸ« Career Counselor Suggestion")
        counselor_msg = generate_counselor_response(raw_text, field, score, suggestions)
        st.info(counselor_msg)

        # Downloadable report
        st.subheader("πŸ“„ Download Your Personalized Career Report")
        report_bytes = generate_pdf_report(raw_text, field, score, suggestions, jobs, counselor_msg)
        b64 = base64.b64encode(report_bytes).decode()
        href = f'<a href="data:application/pdf;base64,{b64}" download="Career_Roadmap_Report.pdf">πŸ“₯ Download PDF Report</a>'
        st.markdown(href, unsafe_allow_html=True)