Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
|
|
|
| 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=[
|
| 32 |
-
|
|
|
|
|
|
|
| 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 |
)
|