Infinity-1995 commited on
Commit
d0f094c
·
verified ·
1 Parent(s): 56a16f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -10,7 +10,8 @@ classifier = pipeline("text-classification", model="distilbert-base-uncased-fine
10
  def detect_job(text, file):
11
  extracted_text = ""
12
  if file:
13
- if file.name.endswith(".pdf"):
 
14
  images = convert_from_bytes(file.read())
15
  for img in images:
16
  extracted_text += pytesseract.image_to_string(img) + "\n"
@@ -28,8 +29,10 @@ def detect_job(text, file):
28
  # Gradio UI
29
  iface = gr.Interface(
30
  fn=detect_job,
31
- inputs=[gr.Textbox(lines=10, placeholder="Paste job description here..."),
32
- gr.File(type=["pdf","png","jpg","jpeg"])],
 
 
33
  outputs="text",
34
  title="Fake Job Detector"
35
  )
 
10
  def detect_job(text, file):
11
  extracted_text = ""
12
  if file:
13
+ filename = file.name
14
+ if filename.endswith(".pdf"):
15
  images = convert_from_bytes(file.read())
16
  for img in images:
17
  extracted_text += pytesseract.image_to_string(img) + "\n"
 
29
  # Gradio UI
30
  iface = gr.Interface(
31
  fn=detect_job,
32
+ inputs=[
33
+ gr.Textbox(lines=10, placeholder="Paste job description here..."),
34
+ gr.File(label="Upload PDF/Image", file_types=[".pdf", ".png", ".jpg", ".jpeg"], type="file")
35
+ ],
36
  outputs="text",
37
  title="Fake Job Detector"
38
  )