Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -68,23 +68,6 @@ def extract_text_markdown(doc, image_paths, page_index, seen_xrefs):
|
|
68 |
|
69 |
@spaces.GPU
|
70 |
def convert(pdf_bytes):
|
71 |
-
# Si no se recibe ningún PDF, se usa uno por defecto.
|
72 |
-
# La siguiente cadena Base64 representa un PDF minimalista que contiene el texto "Default PDF content"
|
73 |
-
if not pdf_bytes:
|
74 |
-
default_pdf_base64 = (
|
75 |
-
"JVBERi0xLjQKMSAwIG9iago8PC9UeXBlIC9DYXRhbG9nIC9QYWdlcyAyIDAgUgovT3V0cHV0cyA8PC9Qcm9jU2V0"
|
76 |
-
"Wy9QREZdPj4+CmVuZG9iagoKMiAwIG9iago8PC9UeXBlIC9QYWdlcyAvS2lkcyBbMyAwIFJdIC9Db3VudCAxPj4K"
|
77 |
-
"ZW5kb2JqCgozIDAgb2JqCjw8L1R5cGUgL1BhZ2UKL1BhZ2VzIDIgMCBSIC9NZWRpYUJveCBbMCAwIDMwIDE0NF0g"
|
78 |
-
"L0NvbnRlbnRzIDQgMCBSPj4KZW5kb2JqCgo0IDAgb2JqCjw8L0xlbmd0aCA1NT4+c3RyZWFtCkJUCjcwIDEwMCBU"
|
79 |
-
"ZApGMSAxMiBUZgooKERlZmF1bHQgUERGIFRleHQgY29udGVudCkgVGoKVEkKVEUKRW5kc3RyZWFtCmVuZG9iagox"
|
80 |
-
"IDAgb2JqCjw8L1R5cGUgL0NhdGFsb2cgL1BhZ2VzIDIgMCBSPj4KZW5kb2JqCnRyYWlsZXIKPDwvU3RyaW5ncyA8"
|
81 |
-
"PC9TdHJpbmdzIDYgMCBSPj4KPGRyZWYKMCAxMDAKPj4KZW5kdHJlYWxlcgo="
|
82 |
-
)
|
83 |
-
# Añadimos relleno si fuese necesario
|
84 |
-
missing_padding = len(default_pdf_base64) % 4
|
85 |
-
if missing_padding:
|
86 |
-
default_pdf_base64 += "=" * (4 - missing_padding)
|
87 |
-
pdf_bytes = base64.b64decode(default_pdf_base64)
|
88 |
|
89 |
temp_pdf_path = "/tmp/uploaded_file.pdf"
|
90 |
with open(temp_pdf_path, "wb") as f:
|
|
|
68 |
|
69 |
@spaces.GPU
|
70 |
def convert(pdf_bytes):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
temp_pdf_path = "/tmp/uploaded_file.pdf"
|
73 |
with open(temp_pdf_path, "wb") as f:
|