Spaces:
Runtime error
Runtime error
Witold Wydmański
commited on
Commit
·
43938ad
1
Parent(s):
5415ed9
feat: add logging
Browse files
app.py
CHANGED
@@ -4,6 +4,9 @@ import pytesseract
|
|
4 |
import os
|
5 |
import fitz # PyMuPDF, imported as fitz for backward compatibility reasons
|
6 |
from PIL import Image
|
|
|
|
|
|
|
7 |
|
8 |
def pdf_to_image(pdf_file, path, progress):
|
9 |
# Convert the PDF to a PNG image using pdf2image
|
@@ -33,7 +36,9 @@ def tesseract_ocr(image, progress=gr.Progress()):
|
|
33 |
return file.name
|
34 |
|
35 |
|
|
|
36 |
if __name__=="__main__":
|
|
|
37 |
iface = gr.Interface(
|
38 |
fn=tesseract_ocr,
|
39 |
inputs=[gr.File(label="PDF file")],
|
|
|
4 |
import os
|
5 |
import fitz # PyMuPDF, imported as fitz for backward compatibility reasons
|
6 |
from PIL import Image
|
7 |
+
import logging
|
8 |
+
|
9 |
+
logging.basicConfig(level=logging.INFO)
|
10 |
|
11 |
def pdf_to_image(pdf_file, path, progress):
|
12 |
# Convert the PDF to a PNG image using pdf2image
|
|
|
36 |
return file.name
|
37 |
|
38 |
|
39 |
+
logging.info("Starting Tesseract OCR")
|
40 |
if __name__=="__main__":
|
41 |
+
logging.info("Running Gradio Interface")
|
42 |
iface = gr.Interface(
|
43 |
fn=tesseract_ocr,
|
44 |
inputs=[gr.File(label="PDF file")],
|