Spaces:
Running
on
Zero
Running
on
Zero
Felipe Silva
commited on
Commit
·
d4a1668
1
Parent(s):
9a8d26c
ajuste decorator
Browse files
utils.py
CHANGED
|
@@ -2,6 +2,7 @@ from PyPDF2 import PdfReader
|
|
| 2 |
from PIL import Image
|
| 3 |
from io import BytesIO
|
| 4 |
from docling.document_converter import DocumentConverter
|
|
|
|
| 5 |
|
| 6 |
EXTENSIONS_IMG_FILES = ['jpeg', 'jpg', 'png']
|
| 7 |
EXTENSIONS_FILES = ['pdf']
|
|
@@ -18,6 +19,7 @@ def fix_type(file_upload):
|
|
| 18 |
elif type_file in EXTENSIONS_FILES:
|
| 19 |
return read_file_pdf(file_upload), type_file
|
| 20 |
|
|
|
|
| 21 |
def doc_converter(file_path):
|
| 22 |
converter = DocumentConverter()
|
| 23 |
result = converter.convert(file_path)
|
|
|
|
| 2 |
from PIL import Image
|
| 3 |
from io import BytesIO
|
| 4 |
from docling.document_converter import DocumentConverter
|
| 5 |
+
import spaces
|
| 6 |
|
| 7 |
EXTENSIONS_IMG_FILES = ['jpeg', 'jpg', 'png']
|
| 8 |
EXTENSIONS_FILES = ['pdf']
|
|
|
|
| 19 |
elif type_file in EXTENSIONS_FILES:
|
| 20 |
return read_file_pdf(file_upload), type_file
|
| 21 |
|
| 22 |
+
@spaces.GPU
|
| 23 |
def doc_converter(file_path):
|
| 24 |
converter = DocumentConverter()
|
| 25 |
result = converter.convert(file_path)
|