Spaces:
Sleeping
Sleeping
Update app.py
Browse files9 unmodified lines101112131314151516171819192021222324257 unmodified lines33343534363738399 unmodified linesdef detect_job(text, file): extracted_text = "" if file: filename = file.name filename = file.name if hasattr(file, "name") else "uploaded_file" if filename.endswith(".pdf"): # file is bytes, convert PDF to images images = convert_from_bytes(file.read()) images = convert_from_bytes(file.read() if hasattr(file, "read") else file) for img in images: extracted_text += pytesseract.image_to_string(img) + "\n" else: img = Image.open(file) img = Image.open(file if hasattr(file, "read") else open(file, "rb")) extracted_text = pytesseract.image_to_string(img)
full_text = text + "\n" + extracted_text if full_text.strip() == "": return "No text provided!"7 unmodified lines fn=detect_job, inputs=[ gr.Textbox(lines=10, placeholder="Paste job description here..."), gr.File(label="Upload PDF/Image", file_types=[".pdf", ".png", ".jpg", ".jpeg"], type="file") gr.File(label="Upload PDF/Image", file_types=[".pdf", ".png", ".jpg", ".jpeg"], type="binary") ], outputs="text", title="Fake Job Detector"app.py+6-4