Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,54 +1,97 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
-
|
| 4 |
-
from
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
classify_field
|
| 9 |
-
recommend_countries,
|
| 10 |
-
recommend_certifications,
|
| 11 |
-
recommend_education,
|
| 12 |
-
generate_roadmap,
|
| 13 |
)
|
| 14 |
|
| 15 |
-
#
|
|
|
|
|
|
|
|
|
|
| 16 |
skills_df = pd.read_csv("data/skills_dataset.csv")
|
| 17 |
countries_df = pd.read_csv("data/countries_dataset.csv")
|
| 18 |
cert_df = pd.read_csv("data/certifications.csv")
|
| 19 |
edu_tech_df = pd.read_csv("data/education_technical.csv")
|
| 20 |
edu_non_tech_df = pd.read_csv("data/education_non_technical.csv")
|
| 21 |
-
scholarship_df = pd.read_csv("data/scholarships.csv")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
if uploaded_file:
|
| 30 |
-
with st.spinner("
|
| 31 |
text = extract_text_from_pdf(uploaded_file)
|
| 32 |
skills, background = extract_entities(text, skills_df)
|
| 33 |
years_exp = extract_experience_years(text)
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
-
st.subheader("
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
-
st.subheader("
|
| 47 |
-
|
| 48 |
-
|
|
|
|
|
|
|
| 49 |
|
| 50 |
-
st.subheader("
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
else:
|
| 54 |
-
st.info("Please upload your CV to
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
+
import pdfplumber
|
| 4 |
+
from extractor import (
|
| 5 |
+
extract_text_from_pdf,
|
| 6 |
+
extract_entities,
|
| 7 |
+
extract_experience_years,
|
| 8 |
+
classify_field
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
)
|
| 10 |
|
| 11 |
+
# Set page configuration
|
| 12 |
+
st.set_page_config(page_title="Skill Scoring & Roadmap App", layout="wide")
|
| 13 |
+
|
| 14 |
+
# Load datasets
|
| 15 |
skills_df = pd.read_csv("data/skills_dataset.csv")
|
| 16 |
countries_df = pd.read_csv("data/countries_dataset.csv")
|
| 17 |
cert_df = pd.read_csv("data/certifications.csv")
|
| 18 |
edu_tech_df = pd.read_csv("data/education_technical.csv")
|
| 19 |
edu_non_tech_df = pd.read_csv("data/education_non_technical.csv")
|
| 20 |
+
scholarship_df = pd.read_csv("data/scholarships.csv")
|
| 21 |
+
|
| 22 |
+
# Helper function
|
| 23 |
+
def score_skills(user_skills):
|
| 24 |
+
if not skills_df.shape[0]:
|
| 25 |
+
return 0
|
| 26 |
+
return int((len(user_skills) / len(skills_df)) * 100)
|
| 27 |
+
|
| 28 |
+
def recommend_countries(skills, years_exp):
|
| 29 |
+
df = countries_df[countries_df['Skill'].isin(skills)]
|
| 30 |
+
df = df[df['MinExperience'] <= years_exp]
|
| 31 |
+
return df[["Country", "JobTitle", "AverageSalary", "VisaPath"]].drop_duplicates().reset_index(drop=True)
|
| 32 |
+
|
| 33 |
+
def recommend_certifications(skills):
|
| 34 |
+
return cert_df[cert_df['Skill'].isin(skills)].reset_index(drop=True)
|
| 35 |
+
|
| 36 |
+
def recommend_education(background):
|
| 37 |
+
return edu_tech_df.reset_index(drop=True) if background == "technical" else edu_non_tech_df.reset_index(drop=True)
|
| 38 |
|
| 39 |
+
def recommend_scholarships(field):
|
| 40 |
+
return scholarship_df[scholarship_df["Field"].str.lower() == field.lower()].reset_index(drop=True)
|
| 41 |
|
| 42 |
+
# UI
|
| 43 |
+
st.title("π Personalized Skill Scoring & Global Career Roadmap")
|
| 44 |
+
st.markdown("Upload your CV and receive a customized global career path, skill score, job matches, education and scholarship suggestions.")
|
| 45 |
+
|
| 46 |
+
uploaded_file = st.file_uploader("π€ Upload your CV (PDF format)", type=["pdf"])
|
| 47 |
|
| 48 |
if uploaded_file:
|
| 49 |
+
with st.spinner("Analyzing your CV..."):
|
| 50 |
text = extract_text_from_pdf(uploaded_file)
|
| 51 |
skills, background = extract_entities(text, skills_df)
|
| 52 |
years_exp = extract_experience_years(text)
|
| 53 |
+
field = classify_field(text)
|
| 54 |
+
|
| 55 |
+
score = score_skills(skills)
|
| 56 |
+
country_info = recommend_countries(skills, years_exp)
|
| 57 |
+
certs = recommend_certifications(skills)
|
| 58 |
+
edu = recommend_education(background)
|
| 59 |
+
scholarships = recommend_scholarships(field)
|
| 60 |
+
|
| 61 |
+
st.subheader("β
Identified Skills")
|
| 62 |
+
st.write(skills or "No recognized skills found.")
|
| 63 |
+
|
| 64 |
+
st.subheader("π Skill Score")
|
| 65 |
+
st.metric("Your Skill Score", f"{score}/100")
|
| 66 |
+
|
| 67 |
+
st.subheader("π§ Experience")
|
| 68 |
+
st.write(f"{years_exp} years of experience detected.")
|
| 69 |
+
|
| 70 |
+
st.subheader("π Categorized Field")
|
| 71 |
+
st.write(f"Detected Field: `{field}` | Background: `{background}`")
|
| 72 |
|
| 73 |
+
st.subheader("π Country Recommendations")
|
| 74 |
+
if not country_info.empty:
|
| 75 |
+
st.dataframe(country_info)
|
| 76 |
+
else:
|
| 77 |
+
st.write("No matching jobs found based on your current skills and experience.")
|
| 78 |
|
| 79 |
+
st.subheader("π Certifications (Free/Paid)")
|
| 80 |
+
if not certs.empty:
|
| 81 |
+
st.dataframe(certs)
|
| 82 |
+
else:
|
| 83 |
+
st.write("No certification recommendations found.")
|
| 84 |
|
| 85 |
+
st.subheader("π Higher Education")
|
| 86 |
+
if not edu.empty:
|
| 87 |
+
st.dataframe(edu)
|
| 88 |
+
else:
|
| 89 |
+
st.write("No higher education recommendations.")
|
| 90 |
|
| 91 |
+
st.subheader("π Scholarship Opportunities")
|
| 92 |
+
if not scholarships.empty:
|
| 93 |
+
st.dataframe(scholarships)
|
| 94 |
+
else:
|
| 95 |
+
st.write("No matching scholarships found.")
|
| 96 |
else:
|
| 97 |
+
st.info("Please upload your CV to begin.")
|