Danial7 commited on
Commit
1fe7fa3
·
verified ·
1 Parent(s): d711e80

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -20
app.py CHANGED
@@ -60,29 +60,39 @@ def create_dynamic_roadmap(skills, certs, scholarships, edu_opps):
60
  now = datetime.now()
61
  roadmap = []
62
 
63
- for i, cert in enumerate(certs['Certification'].tolist()[:2]):
64
- roadmap.append({
65
- "Task": f"Complete {cert}",
66
- "Start": (now + timedelta(days=i*30)).strftime("%Y-%m-%d"),
67
- "Finish": (now + timedelta(days=(i+1)*30)).strftime("%Y-%m-%d")
68
- })
69
-
70
- for i, scholarship in enumerate(scholarships['Scholarship'].tolist()[:2]):
71
- roadmap.append({
72
- "Task": f"Apply for {scholarship}",
73
- "Start": (now + timedelta(days=90 + i*30)).strftime("%Y-%m-%d"),
74
- "Finish": (now + timedelta(days=120 + i*30)).strftime("%Y-%m-%d")
75
- })
76
-
77
- for i, degree in enumerate(edu_opps['Program'].tolist()[:1]):
78
- roadmap.append({
79
- "Task": f"Pursue {degree}",
80
- "Start": (now + timedelta(days=180)).strftime("%Y-%m-%d"),
81
- "Finish": (now + timedelta(days=720)).strftime("%Y-%m-%d")
82
- })
 
 
 
 
 
 
 
 
 
83
 
84
  return pd.DataFrame(roadmap)
85
 
 
86
  # UI
87
  st.title("📊 Personalized Skill Scoring & Career Roadmap App")
88
  st.markdown("Upload your CV and get a detailed roadmap with live job listings.")
 
60
  now = datetime.now()
61
  roadmap = []
62
 
63
+ # Detect a valid certification column
64
+ cert_col = next((col for col in certs.columns if col.lower() in ["certification", "name", "title"]), None)
65
+ if cert_col:
66
+ for i, cert in enumerate(certs[cert_col].dropna().tolist()[:2]):
67
+ roadmap.append({
68
+ "Task": f"Complete {cert}",
69
+ "Start": (now + timedelta(days=i * 30)).strftime("%Y-%m-%d"),
70
+ "Finish": (now + timedelta(days=(i + 1) * 30)).strftime("%Y-%m-%d")
71
+ })
72
+
73
+ # Detect a valid scholarship column
74
+ scholarship_col = next((col for col in scholarships.columns if col.lower() in ["scholarship", "name", "title"]), None)
75
+ if scholarship_col:
76
+ for i, scholarship in enumerate(scholarships[scholarship_col].dropna().tolist()[:2]):
77
+ roadmap.append({
78
+ "Task": f"Apply for {scholarship}",
79
+ "Start": (now + timedelta(days=90 + i * 30)).strftime("%Y-%m-%d"),
80
+ "Finish": (now + timedelta(days=120 + i * 30)).strftime("%Y-%m-%d")
81
+ })
82
+
83
+ # Detect a valid education column
84
+ edu_col = next((col for col in edu_opps.columns if col.lower() in ["program", "course", "degree", "title"]), None)
85
+ if edu_col:
86
+ for i, degree in enumerate(edu_opps[edu_col].dropna().tolist()[:1]):
87
+ roadmap.append({
88
+ "Task": f"Pursue {degree}",
89
+ "Start": (now + timedelta(days=180)).strftime("%Y-%m-%d"),
90
+ "Finish": (now + timedelta(days=720)).strftime("%Y-%m-%d")
91
+ })
92
 
93
  return pd.DataFrame(roadmap)
94
 
95
+
96
  # UI
97
  st.title("📊 Personalized Skill Scoring & Career Roadmap App")
98
  st.markdown("Upload your CV and get a detailed roadmap with live job listings.")