Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,20 +8,22 @@ from utils.suggestions import (
|
|
| 8 |
get_career_advice,
|
| 9 |
get_job_listings,
|
| 10 |
)
|
|
|
|
| 11 |
import base64
|
| 12 |
import io
|
| 13 |
import datetime
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
st.title("Universal Smart CV Analyzer & Career Roadmap")
|
| 16 |
|
| 17 |
uploaded_file = st.file_uploader("Upload your CV in PDF format", type=["pdf"])
|
| 18 |
|
| 19 |
if uploaded_file is not None:
|
| 20 |
-
# Save uploaded file temporarily
|
| 21 |
with open("temp_cv.pdf", "wb") as f:
|
| 22 |
f.write(uploaded_file.getbuffer())
|
| 23 |
|
| 24 |
-
# Parse CV
|
| 25 |
parsed_text = parse_cv("temp_cv.pdf")
|
| 26 |
education_level = extract_education_level(parsed_text)
|
| 27 |
cv_type = identify_cv_type(parsed_text)
|
|
@@ -32,7 +34,6 @@ if uploaded_file is not None:
|
|
| 32 |
st.write(f"**Education Level:** {education_level}")
|
| 33 |
st.write(f"### Overall CV Score: {score} / 100")
|
| 34 |
st.write("### Score Breakdown:")
|
| 35 |
-
|
| 36 |
for k, v in score_breakdown.items():
|
| 37 |
st.write(f"- {k}: {v}")
|
| 38 |
|
|
@@ -57,52 +58,9 @@ if uploaded_file is not None:
|
|
| 57 |
for job in jobs:
|
| 58 |
st.write(f"- {job}")
|
| 59 |
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
report += f"CV Type: {cv_type}\n"
|
| 64 |
-
report += f"Education Level: {education_level}\n"
|
| 65 |
-
report += f"Overall CV Score: {score} / 100\n\n"
|
| 66 |
-
|
| 67 |
-
report += "Score Breakdown:\n"
|
| 68 |
-
for k, v in score_breakdown.items():
|
| 69 |
-
report += f"- {k}: {v}\n"
|
| 70 |
-
|
| 71 |
-
report += "\nCertification Suggestions:\n"
|
| 72 |
-
if isinstance(certs, list):
|
| 73 |
-
report += "\n".join(certs) + "\n\n"
|
| 74 |
-
else:
|
| 75 |
-
report += str(certs) + "\n\n"
|
| 76 |
-
|
| 77 |
-
report += "Higher Education Suggestions:\n"
|
| 78 |
-
if isinstance(edu, list):
|
| 79 |
-
report += "\n".join(edu) + "\n\n"
|
| 80 |
-
else:
|
| 81 |
-
report += str(edu) + "\n\n"
|
| 82 |
-
|
| 83 |
-
report += "Visa Recommendations:\n"
|
| 84 |
-
if isinstance(visa, list):
|
| 85 |
-
report += "\n".join(visa) + "\n\n"
|
| 86 |
-
else:
|
| 87 |
-
report += str(visa) + "\n\n"
|
| 88 |
-
|
| 89 |
-
report += "Career Advice:\n" + str(advice) + "\n\n"
|
| 90 |
-
|
| 91 |
-
report += "Job Listings:\n"
|
| 92 |
-
if isinstance(jobs, list):
|
| 93 |
-
for job in jobs:
|
| 94 |
-
report += f"- {job}\n"
|
| 95 |
-
else:
|
| 96 |
-
report += str(jobs) + "\n"
|
| 97 |
-
|
| 98 |
-
return report
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
report_text = generate_report()
|
| 103 |
-
b64 = base64.b64encode(report_text.encode()).decode()
|
| 104 |
-
href = f'<a href="data:file/txt;base64,{b64}" download="cv_analysis_report.txt">Download Full CV Analysis Report</a>'
|
| 105 |
-
st.markdown(href, unsafe_allow_html=True)
|
| 106 |
|
| 107 |
from PIL import Image
|
| 108 |
|
|
@@ -179,4 +137,3 @@ def generate_pdf_report():
|
|
| 179 |
pdf.output(pdf_buffer)
|
| 180 |
pdf_buffer.seek(0)
|
| 181 |
return pdf_buffer
|
| 182 |
-
|
|
|
|
| 8 |
get_career_advice,
|
| 9 |
get_job_listings,
|
| 10 |
)
|
| 11 |
+
from utils.visualizer import generate_timeline
|
| 12 |
import base64
|
| 13 |
import io
|
| 14 |
import datetime
|
| 15 |
+
from fpdf import FPDF
|
| 16 |
+
from matplotlib.backends.backend_agg import RendererAgg
|
| 17 |
+
import matplotlib.pyplot as plt
|
| 18 |
|
| 19 |
st.title("Universal Smart CV Analyzer & Career Roadmap")
|
| 20 |
|
| 21 |
uploaded_file = st.file_uploader("Upload your CV in PDF format", type=["pdf"])
|
| 22 |
|
| 23 |
if uploaded_file is not None:
|
|
|
|
| 24 |
with open("temp_cv.pdf", "wb") as f:
|
| 25 |
f.write(uploaded_file.getbuffer())
|
| 26 |
|
|
|
|
| 27 |
parsed_text = parse_cv("temp_cv.pdf")
|
| 28 |
education_level = extract_education_level(parsed_text)
|
| 29 |
cv_type = identify_cv_type(parsed_text)
|
|
|
|
| 34 |
st.write(f"**Education Level:** {education_level}")
|
| 35 |
st.write(f"### Overall CV Score: {score} / 100")
|
| 36 |
st.write("### Score Breakdown:")
|
|
|
|
| 37 |
for k, v in score_breakdown.items():
|
| 38 |
st.write(f"- {k}: {v}")
|
| 39 |
|
|
|
|
| 58 |
for job in jobs:
|
| 59 |
st.write(f"- {job}")
|
| 60 |
|
| 61 |
+
st.header("📈 Career Roadmap Timeline")
|
| 62 |
+
fig = generate_timeline(parsed_text)
|
| 63 |
+
st.pyplot(fig)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
from PIL import Image
|
| 66 |
|
|
|
|
| 137 |
pdf.output(pdf_buffer)
|
| 138 |
pdf_buffer.seek(0)
|
| 139 |
return pdf_buffer
|
|
|