Update app.py
Browse files
app.py
CHANGED
@@ -23,19 +23,11 @@ def greet(img):
|
|
23 |
with open(_output_name, "w", encoding="utf-8", errors="ignore") as f:
|
24 |
f.write(res)
|
25 |
print("Writing into file")
|
26 |
-
|
27 |
-
base64_encoded_pdfs = list()
|
28 |
-
for i, (xml, img) in enumerate(zip(xml_outputs, doc)):
|
29 |
-
xml_element_tree = xml[1]
|
30 |
-
parser.export_pdfa(_output_name_pdf,
|
31 |
-
hocr=xml_element_tree, image=img)
|
32 |
-
with open(_output_name_pdf, 'rb') as f:
|
33 |
-
base64_encoded_pdfs.append(base64.b64encode(f.read()))
|
34 |
-
return res, _output_name, _output_name_pdf
|
35 |
|
36 |
demo = gr.Interface(fn=greet,
|
37 |
inputs=gr.Image(type="pil"),
|
38 |
-
outputs=["text", "file"
|
39 |
title=title,
|
40 |
description=description
|
41 |
)
|
|
|
23 |
with open(_output_name, "w", encoding="utf-8", errors="ignore") as f:
|
24 |
f.write(res)
|
25 |
print("Writing into file")
|
26 |
+
return res, _output_name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
demo = gr.Interface(fn=greet,
|
29 |
inputs=gr.Image(type="pil"),
|
30 |
+
outputs=["text", "file"],
|
31 |
title=title,
|
32 |
description=description
|
33 |
)
|