Danial7 commited on
Commit
982197c
·
verified ·
1 Parent(s): 8102e23

Update utils/visualizer.py

Browse files
Files changed (1) hide show
  1. utils/visualizer.py +31 -10
utils/visualizer.py CHANGED
@@ -1,20 +1,41 @@
1
  import matplotlib.pyplot as plt
2
 
3
- def generate_timeline(text):
4
- stages = ["Skill Development", "Certifications", "Higher Education", "Job Applications", "Visa Process"]
5
- durations = [2, 2, 3, 1, 1] # Example durations in months or quarters
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  fig, ax = plt.subplots(figsize=(10, 2))
8
  ax.barh(["Roadmap"], [sum(durations)], color="lightgray")
9
-
10
  left = 0
11
  for stage, duration in zip(stages, durations):
12
  ax.barh(["Roadmap"], [duration], left=left, label=stage)
13
  left += duration
14
-
15
- ax.set_xlim(0, sum(durations))
16
- ax.set_xlabel("Timeline (months)")
17
- ax.set_yticks([])
18
- ax.legend(loc='upper center', bbox_to_anchor=(0.5, 1.25), ncol=3)
19
- plt.tight_layout()
20
  return fig
 
1
  import matplotlib.pyplot as plt
2
 
3
+ def generate_timeline(cv_type, education_level, score):
4
+ stages = []
5
+ durations = []
6
+
7
+ if score < 60:
8
+ stages.append("Skill Development")
9
+ durations.append(3)
10
+ elif score < 80:
11
+ stages.append("Skill Polishing")
12
+ durations.append(2)
13
+
14
+ if education_level.lower() in ["high school", "bachelor"]:
15
+ stages.append("Certifications")
16
+ durations.append(2)
17
+
18
+ if education_level.lower() in ["high school", "bachelor"]:
19
+ stages.append("Higher Education")
20
+ durations.append(3)
21
+
22
+ stages.append("Job Applications")
23
+ durations.append(1)
24
+
25
+ if cv_type.lower() in ["technical", "engineering", "it"]:
26
+ stages.append("Interview Prep")
27
+ durations.append(1)
28
+
29
+ stages.append("Visa Process")
30
+ durations.append(1)
31
 
32
  fig, ax = plt.subplots(figsize=(10, 2))
33
  ax.barh(["Roadmap"], [sum(durations)], color="lightgray")
 
34
  left = 0
35
  for stage, duration in zip(stages, durations):
36
  ax.barh(["Roadmap"], [duration], left=left, label=stage)
37
  left += duration
38
+ ax.legend(bbox_to_anchor=(1.05, 1), loc='upper left')
39
+ ax.set_title("Career Roadmap Timeline")
40
+ ax.axis('off')
 
 
 
41
  return fig