Karthikeyan commited on
Commit
3c8d95f
1 Parent(s): 4cd09fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -21
app.py CHANGED
@@ -60,12 +60,6 @@ class ResumeAnalyser:
60
 
61
 
62
  def matching_percentage(self,job_description_path, resume_path):
63
- percentage = None
64
- reason = None
65
- skills = None
66
- keywords = None
67
- fig = None
68
-
69
  job_description_path = job_description_path.name
70
  resume_path = resume_path.name
71
 
@@ -73,32 +67,37 @@ class ResumeAnalyser:
73
 
74
  result = generated_text
75
 
76
- match = re.search(r"(Matched Percentage: (.+))", result)
77
- percentage = match.group(1)
78
-
79
- match = re.search(r"(Reason: (.+))", result)
80
- reason = match.group(1)
81
-
82
- match = re.search(r"(Skills To Improve: (.+))", result)
83
- skills = match.group(1)
84
-
85
- match = re.search(r"(Keywords: (.+))", result)
86
- keywords = match.group(1)
 
 
 
 
 
87
 
88
 
89
  # Extract the matched percentage using regular expression
90
- match1 = re.search(r"Matched Percentage: (\d+)%", percentage)
91
- matched_percentage = int(match1.group(1))
92
 
93
  # Creating a pie chart with plotly
94
  labels = ['Matched', 'Remaining']
95
- values = [matched_percentage, 100 - matched_percentage]
96
 
97
  fig = go.Figure(data=[go.Pie(labels=labels, values=values)])
98
  # fig.update_layout(title='Matched Percentage')
99
 
100
 
101
- return percentage,reason, skills, keywords,fig
102
 
103
 
104
  def gradio_interface(self):
 
60
 
61
 
62
  def matching_percentage(self,job_description_path, resume_path):
 
 
 
 
 
 
63
  job_description_path = job_description_path.name
64
  resume_path = resume_path.name
65
 
 
67
 
68
  result = generated_text
69
 
70
+ lines = result.split('\n')
71
+
72
+ matched_percentage = None
73
+ reason = None
74
+ skills_to_improve = None
75
+ keywords = None
76
+
77
+ for line in lines:
78
+ if line.startswith('Matched Percentage:'):
79
+ matched_percentage = line.split(':')[1].strip()
80
+ elif line.startswith('Reason'):
81
+ reason = line.split(':')[1].strip()
82
+ elif line.startswith('Skills To Improve'):
83
+ skills_to_improve = line.split(':')[1].strip()
84
+ elif line.startswith('Keywords'):
85
+ keywords = line.split(':')[1].strip()
86
 
87
 
88
  # Extract the matched percentage using regular expression
89
+ match1 = re.search(r"Matched Percentage: (\d+)%", matched_percentage)
90
+ matched_Percentage = int(match1.group(1))
91
 
92
  # Creating a pie chart with plotly
93
  labels = ['Matched', 'Remaining']
94
+ values = [matched_Percentage, 100 - matched_Percentage]
95
 
96
  fig = go.Figure(data=[go.Pie(labels=labels, values=values)])
97
  # fig.update_layout(title='Matched Percentage')
98
 
99
 
100
+ return matched_percentage,reason, skills, keywords,fig
101
 
102
 
103
  def gradio_interface(self):