Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,60 +1,65 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
| 2 |
from utils import (
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
| 9 |
)
|
| 10 |
|
| 11 |
-
st.set_page_config(page_title="
|
|
|
|
| 12 |
|
| 13 |
-
st.
|
| 14 |
-
|
| 15 |
-
uploaded_file = st.file_uploader("Upload your CV (TXT or PDF recommended)", type=["txt", "pdf"])
|
| 16 |
|
| 17 |
if uploaded_file:
|
| 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 |
-
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
import base64
|
| 3 |
+
import os
|
| 4 |
+
import tempfile
|
| 5 |
from utils import (
|
| 6 |
+
parse_cv,
|
| 7 |
+
identify_field_with_llm,
|
| 8 |
+
generate_skill_score,
|
| 9 |
+
generate_llm_suggestions,
|
| 10 |
+
get_live_jobs,
|
| 11 |
+
generate_counselor_response,
|
| 12 |
+
generate_pdf_report
|
| 13 |
)
|
| 14 |
|
| 15 |
+
st.set_page_config(page_title="Smart CV Analyzer", layout="wide")
|
| 16 |
+
st.title("π Universal Smart CV Analyzer & Career Roadmap")
|
| 17 |
|
| 18 |
+
uploaded_file = st.file_uploader("Upload your CV (PDF format)", type=["pdf"])
|
|
|
|
|
|
|
| 19 |
|
| 20 |
if uploaded_file:
|
| 21 |
+
with st.spinner("Parsing CV..."):
|
| 22 |
+
with tempfile.NamedTemporaryFile(delete=False) as tmp_file:
|
| 23 |
+
tmp_file.write(uploaded_file.read())
|
| 24 |
+
tmp_path = tmp_file.name
|
| 25 |
+
|
| 26 |
+
raw_text = parse_cv(tmp_path)
|
| 27 |
+
os.unlink(tmp_path)
|
| 28 |
+
|
| 29 |
+
st.subheader("π§ CV Extracted Text")
|
| 30 |
+
st.text_area("Extracted CV Content", raw_text, height=250)
|
| 31 |
+
|
| 32 |
+
with st.spinner("π Identifying field/domain..."):
|
| 33 |
+
field = identify_field_with_llm(raw_text)
|
| 34 |
+
st.success(f"Detected Field: {field}")
|
| 35 |
+
|
| 36 |
+
with st.spinner("π Generating Skill Score..."):
|
| 37 |
+
score = generate_skill_score(raw_text)
|
| 38 |
+
st.metric("Skill Score (0β100)", score)
|
| 39 |
+
|
| 40 |
+
with st.spinner("π§ Generating AI-based suggestions..."):
|
| 41 |
+
suggestions = generate_llm_suggestions(raw_text, field)
|
| 42 |
+
|
| 43 |
+
st.subheader("π Career Suggestions")
|
| 44 |
+
st.markdown(f"**Upskilling Skills:** {', '.join(suggestions['skills'])}")
|
| 45 |
+
st.markdown(f"**Certifications:** {', '.join(suggestions['certifications'])}")
|
| 46 |
+
st.markdown(f"**Scholarships:** {', '.join(suggestions['scholarships'])}")
|
| 47 |
+
st.markdown(f"**Education Opportunities:** {', '.join(suggestions['education'])}")
|
| 48 |
+
st.markdown(f"**Visa Pathways:** {', '.join(suggestions['visa'])}")
|
| 49 |
+
|
| 50 |
+
with st.spinner("π Finding live jobs..."):
|
| 51 |
+
jobs = get_live_jobs(field)
|
| 52 |
+
st.subheader("πΌ Live Job Opportunities")
|
| 53 |
+
for job in jobs:
|
| 54 |
+
st.markdown(f"- **[{job['title']}]({job['url']})** at *{job['company']}* ({job['location']})")
|
| 55 |
+
|
| 56 |
+
st.subheader("π§βπ« Career Counselor Suggestion")
|
| 57 |
+
counselor_msg = generate_counselor_response(raw_text, field, score, suggestions)
|
| 58 |
+
st.info(counselor_msg)
|
| 59 |
+
|
| 60 |
+
# Downloadable report
|
| 61 |
+
st.subheader("π Download Your Personalized Career Report")
|
| 62 |
+
report_bytes = generate_pdf_report(raw_text, field, score, suggestions, jobs, counselor_msg)
|
| 63 |
+
b64 = base64.b64encode(report_bytes).decode()
|
| 64 |
+
href = f'<a href="data:application/pdf;base64,{b64}" download="Career_Roadmap_Report.pdf">π₯ Download PDF Report</a>'
|
| 65 |
+
st.markdown(href, unsafe_allow_html=True)
|