Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,130 +1,78 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
from PyPDF2 import PdfReader
|
| 3 |
-
from fpdf import FPDF
|
| 4 |
-
import os
|
| 5 |
-
|
| 6 |
from utils import (
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
get_job_listings
|
| 17 |
)
|
| 18 |
|
| 19 |
-
st.set_page_config(page_title="
|
| 20 |
-
st.title("π Universal Smart CV Analyzer & Career Roadmap")
|
| 21 |
-
st.markdown("Upload your CV in PDF format to get a complete personalized analysis and roadmap.")
|
| 22 |
-
|
| 23 |
-
# Upload PDF
|
| 24 |
-
uploaded_file = st.file_uploader("Upload your CV", type="pdf")
|
| 25 |
-
|
| 26 |
-
if uploaded_file:
|
| 27 |
-
with st.spinner("Reading and analyzing your CV..."):
|
| 28 |
-
pdf = PdfReader(uploaded_file)
|
| 29 |
-
text = ""
|
| 30 |
-
for page in pdf.pages:
|
| 31 |
-
text += page.extract_text() or ""
|
| 32 |
-
|
| 33 |
-
# Extract keywords
|
| 34 |
-
keywords = extract_keywords(text)
|
| 35 |
-
st.subheader("π Extracted Keywords")
|
| 36 |
-
st.write(", ".join(keywords))
|
| 37 |
-
|
| 38 |
-
# Identify field
|
| 39 |
-
field = identify_field(keywords)
|
| 40 |
-
st.subheader("π§ Predicted Field")
|
| 41 |
-
st.write(f"**{field}**")
|
| 42 |
-
|
| 43 |
-
# Score the CV
|
| 44 |
-
score = calculate_cv_score(text, keywords)
|
| 45 |
-
st.subheader("π CV Score")
|
| 46 |
-
st.metric(label="Skill Match Score", value=f"{score}/100")
|
| 47 |
-
|
| 48 |
-
# Determine technical background
|
| 49 |
-
background = is_technical_background(keywords)
|
| 50 |
-
st.subheader("π§ Technical Background")
|
| 51 |
-
st.write(f"**{background}**")
|
| 52 |
-
|
| 53 |
-
# Suggestions Section
|
| 54 |
-
st.subheader("π Suggested Upskilling")
|
| 55 |
-
upskills = suggest_upskilling(keywords)
|
| 56 |
-
st.write(upskills if upskills else "No suggestions found.")
|
| 57 |
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
st.write(certifications if certifications else "No certifications found.")
|
| 61 |
|
| 62 |
-
|
| 63 |
-
scholarships = suggest_scholarships(keywords)
|
| 64 |
-
st.write(scholarships if scholarships else "No scholarships found.")
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
base64_pdf = f.read()
|
| 125 |
-
st.download_button(
|
| 126 |
-
label="π Download CV Report",
|
| 127 |
-
data=base64_pdf,
|
| 128 |
-
file_name="cv_analysis_report.pdf",
|
| 129 |
-
mime="application/pdf",
|
| 130 |
-
)
|
|
|
|
| 1 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from utils import (
|
| 3 |
+
get_skills_suggestions,
|
| 4 |
+
get_certification_recommendations,
|
| 5 |
+
get_scholarship_suggestions,
|
| 6 |
+
get_education_opportunities,
|
| 7 |
+
get_visa_pathways,
|
| 8 |
+
get_job_recommendations,
|
| 9 |
+
get_cv_score,
|
| 10 |
+
get_field_classification,
|
| 11 |
+
get_personalized_advice,
|
|
|
|
| 12 |
)
|
| 13 |
|
| 14 |
+
st.set_page_config(page_title="Smart CV Analyzer & Career Roadmap", layout="wide")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
st.title("π Universal Smart CV Analyzer & π Career Roadmap Generator")
|
| 17 |
+
st.markdown("Upload your CV and get a detailed analysis including personalized job suggestions, skill-building advice, education and visa guidance, and a tailored career roadmap.")
|
|
|
|
| 18 |
|
| 19 |
+
uploaded_file = st.file_uploader("Upload your CV (.txt or .pdf)", type=["txt", "pdf"])
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
if uploaded_file:
|
| 22 |
+
file_ext = uploaded_file.name.split('.')[-1]
|
| 23 |
+
if file_ext == "txt":
|
| 24 |
+
cv_text = uploaded_file.read().decode("utf-8")
|
| 25 |
+
elif file_ext == "pdf":
|
| 26 |
+
import PyPDF2
|
| 27 |
+
reader = PyPDF2.PdfReader(uploaded_file)
|
| 28 |
+
cv_text = "\n".join(page.extract_text() for page in reader.pages if page.extract_text())
|
| 29 |
+
else:
|
| 30 |
+
st.error("Unsupported file format.")
|
| 31 |
+
st.stop()
|
| 32 |
+
|
| 33 |
+
with st.spinner("Analyzing your CV..."):
|
| 34 |
+
score = get_cv_score(cv_text)
|
| 35 |
+
field = get_field_classification(cv_text)
|
| 36 |
+
skills = get_skills_suggestions(cv_text)
|
| 37 |
+
certs = get_certification_recommendations(cv_text)
|
| 38 |
+
scholarships = get_scholarship_suggestions(cv_text)
|
| 39 |
+
education = get_education_opportunities(cv_text)
|
| 40 |
+
visa = get_visa_pathways(cv_text, country="USA")
|
| 41 |
+
jobs = get_job_recommendations(cv_text, location="USA")
|
| 42 |
+
advice = get_personalized_advice(cv_text)
|
| 43 |
+
|
| 44 |
+
st.header("π CV Summary")
|
| 45 |
+
st.write(f"**Score:** {score}/100")
|
| 46 |
+
st.write(f"**Field/Domain:** {field}")
|
| 47 |
+
|
| 48 |
+
st.header("π‘ Personalized Career Advice")
|
| 49 |
+
st.success(advice)
|
| 50 |
+
|
| 51 |
+
st.header("π§ Recommended Skills to Learn")
|
| 52 |
+
for skill in skills:
|
| 53 |
+
st.markdown(f"- {skill}")
|
| 54 |
+
|
| 55 |
+
st.header("π Recommended Certifications")
|
| 56 |
+
for cert in certs:
|
| 57 |
+
st.markdown(f"- {cert}")
|
| 58 |
+
|
| 59 |
+
st.header("π― Scholarship Opportunities")
|
| 60 |
+
for s in scholarships:
|
| 61 |
+
st.markdown(f"- {s}")
|
| 62 |
+
|
| 63 |
+
st.header("π« Education Paths")
|
| 64 |
+
for edu in education:
|
| 65 |
+
st.markdown(f"- {edu}")
|
| 66 |
+
|
| 67 |
+
st.header("π Visa Pathways")
|
| 68 |
+
for v in visa:
|
| 69 |
+
st.markdown(f"- {v}")
|
| 70 |
+
|
| 71 |
+
st.header("πΌ Job Opportunities (USA)")
|
| 72 |
+
for job in jobs:
|
| 73 |
+
st.subheader(job.get("title", "N/A"))
|
| 74 |
+
st.markdown(f"**Company:** {job.get('company', 'Unknown')}")
|
| 75 |
+
st.markdown(f"**Location:** {job.get('location', 'Unknown')}")
|
| 76 |
+
st.markdown(f"**Description:** {job.get('description', '')[:300]}...")
|
| 77 |
+
st.markdown(f"[Apply Here]({job.get('url', '#')})")
|
| 78 |
+
st.markdown("---")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|