Manojajj commited on
Commit
2543fdd
·
verified ·
1 Parent(s): 4df6b19

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -24
app.py CHANGED
@@ -17,7 +17,7 @@ def extract_text_from_pdf(pdf_file):
17
  return text
18
 
19
  def parse_resume(resume_text):
20
- """Parse the resume and extract details like name, email, phone, skills, etc."""
21
  # Define regex for phone and email extraction
22
  phone_pattern = r'\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}'
23
  email_pattern = r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}'
@@ -26,34 +26,15 @@ def parse_resume(resume_text):
26
  phone = re.findall(phone_pattern, resume_text)
27
  email = re.findall(email_pattern, resume_text)
28
 
29
- # Extract named entities (e.g., skills, education, and experience)
30
  entities = nlp(resume_text)
31
-
32
- # For simplicity, we just list out the entities here
33
- skills = []
34
- experience = []
35
- education = []
36
- certifications = []
37
 
38
- # Iterate through recognized entities and categorize them
39
- for entity in entities:
40
- if 'ORG' in entity['entity']:
41
- experience.append(entity['word'])
42
- elif 'MISC' in entity['entity']:
43
- skills.append(entity['word'])
44
- elif 'LOC' in entity['entity']:
45
- education.append(entity['word'])
46
- else:
47
- certifications.append(entity['word'])
48
-
49
- # Create a dictionary of parsed data
50
  parsed_data = {
51
  "Phone": phone[0] if phone else "Not found",
52
  "Email": email[0] if email else "Not found",
53
  "Skills": ", ".join(skills),
54
- "Experience": ", ".join(experience),
55
- "Education": ", ".join(education),
56
- "Certifications": ", ".join(certifications)
57
  }
58
 
59
  return parsed_data
@@ -83,5 +64,5 @@ gr.Interface(
83
  inputs=gr.File(file_count="multiple", label="Upload Resumes (PDFs)"),
84
  outputs=gr.File(label="Download Parsed Data (Excel)"),
85
  title="AI Resume Parser",
86
- description="Upload multiple resumes (PDFs) to extract details like Name, Email, Phone, Skills, Experience, Education, and Certifications. The results will be saved in an Excel file."
87
  ).launch()
 
17
  return text
18
 
19
  def parse_resume(resume_text):
20
+ """Parse the resume and extract details like name, email, phone, and skills."""
21
  # Define regex for phone and email extraction
22
  phone_pattern = r'\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}'
23
  email_pattern = r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}'
 
26
  phone = re.findall(phone_pattern, resume_text)
27
  email = re.findall(email_pattern, resume_text)
28
 
29
+ # Extract named entities for skills
30
  entities = nlp(resume_text)
31
+ skills = [entity['word'] for entity in entities if 'MISC' in entity['entity']]
 
 
 
 
 
32
 
33
+ # Create a dictionary of parsed data (exclude Experience, Education, Certifications)
 
 
 
 
 
 
 
 
 
 
 
34
  parsed_data = {
35
  "Phone": phone[0] if phone else "Not found",
36
  "Email": email[0] if email else "Not found",
37
  "Skills": ", ".join(skills),
 
 
 
38
  }
39
 
40
  return parsed_data
 
64
  inputs=gr.File(file_count="multiple", label="Upload Resumes (PDFs)"),
65
  outputs=gr.File(label="Download Parsed Data (Excel)"),
66
  title="AI Resume Parser",
67
+ description="Upload multiple resumes (PDFs) to extract details like Name, Email, Phone, and Skills. The results will be saved in an Excel file."
68
  ).launch()