Danial7 commited on
Commit
fdf83c7
Β·
verified Β·
1 Parent(s): 62b171f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +76 -33
app.py CHANGED
@@ -1,54 +1,97 @@
1
  import streamlit as st
2
  import pandas as pd
3
-
4
- from utils import extract_text_from_pdf
5
- from extractor import extract_entities, extract_experience_years
6
- from recommender import (
7
- score_skills,
8
- classify_field,
9
- recommend_countries,
10
- recommend_certifications,
11
- recommend_education,
12
- generate_roadmap,
13
  )
14
 
15
- # Load data
 
 
 
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") # Optional
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
- st.set_page_config(page_title="Skill Scoring App", layout="wide")
24
- st.title("πŸ“Š Personalized Skill Scoring & Career Roadmap App")
25
 
26
- uploaded_file = st.file_uploader("πŸ“€ Upload your CV (PDF)", type=["pdf"])
27
- age = st.number_input("Enter your age (if not in CV)", min_value=16, max_value=70)
 
 
 
28
 
29
  if uploaded_file:
30
- with st.spinner("Processing your CV..."):
31
  text = extract_text_from_pdf(uploaded_file)
32
  skills, background = extract_entities(text, skills_df)
33
  years_exp = extract_experience_years(text)
34
- score = score_skills(skills, skills_df)
35
- field = classify_field(text, ["Engineering", "Medical", "IT", "Finance", "Labor", "HVAC"])
36
- countries = recommend_countries(skills, countries_df)
37
- certs = recommend_certifications(skills, cert_df)
38
- edu = recommend_education(background, edu_tech_df, edu_non_tech_df)
39
- roadmap = generate_roadmap(
40
- {"years_experience": years_exp}, field, score, countries, certs, scholarship_df
41
- )
 
 
 
 
 
 
 
 
 
 
 
42
 
43
- st.subheader("βœ… Extracted Skills")
44
- st.write(skills or "No skills found.")
 
 
 
45
 
46
- st.subheader("πŸ“ˆ Score & Field")
47
- st.metric("Skill Score", f"{score}/100")
48
- st.write(f"**Field Classification:** {field}")
 
 
49
 
50
- st.subheader("πŸ—ΊοΈ Roadmap")
51
- st.markdown(roadmap, unsafe_allow_html=True)
 
 
 
52
 
 
 
 
 
 
53
  else:
54
- st.info("Please upload your CV to get started.")
 
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.")