Spaces:
Runtime error
Runtime error
Commit
·
2e6fb2c
1
Parent(s):
26072cc
Update app.py
Browse files
app.py
CHANGED
@@ -31,8 +31,8 @@ def pdf_to_text(file):
|
|
31 |
doc = fitz.open(file.name)
|
32 |
full_text = ''
|
33 |
for i, page in enumerate(doc):
|
34 |
-
page_text = page.
|
35 |
-
images = page.
|
36 |
if images:
|
37 |
for image in images:
|
38 |
xref = image[0]
|
@@ -50,6 +50,7 @@ def pdf_to_text(file):
|
|
50 |
f.write(full_text)
|
51 |
return output_file_name, page_number
|
52 |
|
|
|
53 |
iface = gr.Interface(fn=pdf_to_text,
|
54 |
inputs=gr.inputs.File(label="Your PDF"),
|
55 |
outputs=gr.outputs.File(label="Download TXT"),
|
|
|
31 |
doc = fitz.open(file.name)
|
32 |
full_text = ''
|
33 |
for i, page in enumerate(doc):
|
34 |
+
page_text = page.get_text()
|
35 |
+
images = page.get_image_list()
|
36 |
if images:
|
37 |
for image in images:
|
38 |
xref = image[0]
|
|
|
50 |
f.write(full_text)
|
51 |
return output_file_name, page_number
|
52 |
|
53 |
+
|
54 |
iface = gr.Interface(fn=pdf_to_text,
|
55 |
inputs=gr.inputs.File(label="Your PDF"),
|
56 |
outputs=gr.outputs.File(label="Download TXT"),
|