Navya-Sree commited on
Commit
5ba68ca
·
verified ·
1 Parent(s): df7b6ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -1,9 +1,10 @@
 
1
  import sys
2
  if "huggingface_hub" in sys.modules:
3
  sys.modules.pop("huggingface_hub")
4
  import huggingface_hub
5
  sys.modules["huggingface_hub"] = huggingface_hub
6
-
7
  import gradio as gr
8
  import json
9
  import numpy as np
@@ -17,7 +18,7 @@ with open('job_roles.json') as f:
17
  job_roles = json.load(f)
18
 
19
  # Load Sentence-BERT model
20
- model = SentenceTransformer('all-MiniLM-L6-v2')
21
 
22
  # Precompute job role embeddings
23
  role_descriptions = [f"{role['title']}: {role['description']} Skills: {', '.join(role['skills'])}"
@@ -27,7 +28,7 @@ role_embeddings = model.encode(role_descriptions)
27
  def analyze_resume(resume_file):
28
  # Extract text from PDF
29
  text = ""
30
- with pdfplumber.open(resume_file.name) as pdf:
31
  for page in pdf.pages:
32
  text += page.extract_text()
33
 
@@ -68,7 +69,8 @@ with gr.Blocks(title="Career Path Recommender") as demo:
68
  gr.Markdown("Upload your resume to discover your top 3 career matches with skill gap analysis")
69
 
70
  with gr.Row():
71
- resume_input = gr.File(label="Upload Resume (PDF)", type="file")
 
72
  output = gr.JSON(label="Recommended Career Paths")
73
 
74
  submit_btn = gr.Button("Analyze Resume")
 
1
+ # IMPORT FIX: Handle huggingface_hub compatibility
2
  import sys
3
  if "huggingface_hub" in sys.modules:
4
  sys.modules.pop("huggingface_hub")
5
  import huggingface_hub
6
  sys.modules["huggingface_hub"] = huggingface_hub
7
+
8
  import gradio as gr
9
  import json
10
  import numpy as np
 
18
  job_roles = json.load(f)
19
 
20
  # Load Sentence-BERT model
21
+ model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
22
 
23
  # Precompute job role embeddings
24
  role_descriptions = [f"{role['title']}: {role['description']} Skills: {', '.join(role['skills'])}"
 
28
  def analyze_resume(resume_file):
29
  # Extract text from PDF
30
  text = ""
31
+ with pdfplumber.open(resume_file) as pdf:
32
  for page in pdf.pages:
33
  text += page.extract_text()
34
 
 
69
  gr.Markdown("Upload your resume to discover your top 3 career matches with skill gap analysis")
70
 
71
  with gr.Row():
72
+ # FIXED: Changed type to 'filepath'
73
+ resume_input = gr.File(label="Upload Resume (PDF)", type="filepath")
74
  output = gr.JSON(label="Recommended Career Paths")
75
 
76
  submit_btn = gr.Button("Analyze Resume")