Spaces:
Runtime error
Runtime error
BhagatSurya
commited on
Commit
•
e787464
1
Parent(s):
ea69e31
Update app.py
Browse files
app.py
CHANGED
@@ -41,7 +41,7 @@ def pdf_to_text(file):
|
|
41 |
xref, name, ext, color_space, width, height, bpc, image_data, image_mask, smask_data = img
|
42 |
# Check if image_data is base64 encoded string
|
43 |
if isinstance(image_data, str) and re.match(r'^[A-Za-z0-9+/]+[=]{0,2}$', image_data):
|
44 |
-
image_data =
|
45 |
try:
|
46 |
image = Image.open(io.BytesIO(image_data))
|
47 |
latex_code = image_to_latex(image)
|
@@ -62,6 +62,7 @@ def pdf_to_text(file):
|
|
62 |
|
63 |
return output_file_name
|
64 |
|
|
|
65 |
iface = gr.Interface(fn=pdf_to_text,
|
66 |
inputs=gr.inputs.File(label="Your PDF"),
|
67 |
outputs=gr.outputs.File(label="Download TXT"),
|
|
|
41 |
xref, name, ext, color_space, width, height, bpc, image_data, image_mask, smask_data = img
|
42 |
# Check if image_data is base64 encoded string
|
43 |
if isinstance(image_data, str) and re.match(r'^[A-Za-z0-9+/]+[=]{0,2}$', image_data):
|
44 |
+
image_data = safe_base64_decode(image_data)
|
45 |
try:
|
46 |
image = Image.open(io.BytesIO(image_data))
|
47 |
latex_code = image_to_latex(image)
|
|
|
62 |
|
63 |
return output_file_name
|
64 |
|
65 |
+
|
66 |
iface = gr.Interface(fn=pdf_to_text,
|
67 |
inputs=gr.inputs.File(label="Your PDF"),
|
68 |
outputs=gr.outputs.File(label="Download TXT"),
|