Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,17 +21,17 @@ def find_layout(image):
|
|
| 21 |
result = table_engine(img)
|
| 22 |
# save_structure_res(result, save_folder, os.path.basename("result").split('.')[0])
|
| 23 |
|
| 24 |
-
final_text =
|
| 25 |
for line in result:
|
| 26 |
-
line
|
| 27 |
-
|
| 28 |
-
|
| 29 |
|
| 30 |
# h, w, _ = img.shape
|
| 31 |
# res = sorted_layout_boxes(result, w)
|
| 32 |
# convert_info_docx(img, res, save_folder, os.path.basename("result").split('.')[0])
|
| 33 |
|
| 34 |
-
return
|
| 35 |
|
| 36 |
iface = gr.Interface(fn=find_layout, inputs=[gr.Image(type="pil")], outputs="text", examples=examples)
|
| 37 |
iface.launch()
|
|
|
|
| 21 |
result = table_engine(img)
|
| 22 |
# save_structure_res(result, save_folder, os.path.basename("result").split('.')[0])
|
| 23 |
|
| 24 |
+
final_text = ""
|
| 25 |
for line in result:
|
| 26 |
+
if "res" in line:
|
| 27 |
+
print(line)
|
| 28 |
+
final_text += line["res"][0]["text"]
|
| 29 |
|
| 30 |
# h, w, _ = img.shape
|
| 31 |
# res = sorted_layout_boxes(result, w)
|
| 32 |
# convert_info_docx(img, res, save_folder, os.path.basename("result").split('.')[0])
|
| 33 |
|
| 34 |
+
return final_text
|
| 35 |
|
| 36 |
iface = gr.Interface(fn=find_layout, inputs=[gr.Image(type="pil")], outputs="text", examples=examples)
|
| 37 |
iface.launch()
|