Jekyll2000 commited on
Commit
50329bd
·
verified ·
1 Parent(s): 04727ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -18,10 +18,13 @@ def setup_chromadb():
18
 
19
  def extract_text_from_resume(file):
20
  if file.name.endswith(".pdf"):
21
- with fitz.open(stream=file.content, filetype="pdf") as doc:
 
22
  return "\n".join([page.get_text("text") for page in doc])
23
  elif file.name.endswith(".txt"):
24
- return file.content.decode("utf-8")
 
 
25
  return ""
26
 
27
  def extract_candidate_name(resume_text):
 
18
 
19
  def extract_text_from_resume(file):
20
  if file.name.endswith(".pdf"):
21
+ # For PDF files, read the bytes directly
22
+ with fitz.open(stream=file, filetype="pdf") as doc:
23
  return "\n".join([page.get_text("text") for page in doc])
24
  elif file.name.endswith(".txt"):
25
+ # For text files, read as string
26
+ with open(file.name, "r", encoding="utf-8") as f:
27
+ return f.read()
28
  return ""
29
 
30
  def extract_candidate_name(resume_text):