Spaces:
Runtime error
Runtime error
File size: 629 Bytes
efe1e83 a660df8 3e1e9fa 918e972 efe1e83 3e1e9fa 73a2704 24da6e7 73a2704 513b66c a660df8 6afb5fb 3e1e9fa efe1e83 3e1e9fa 6afb5fb 3e1e9fa efe1e83 3e1e9fa 24da6e7 efe1e83 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import gradio as gr
import os
import numpy as np
from paddleocr import PPStructure,draw_structure_result,save_structure_res
# Chinese image
table_engine = PPStructure(show_log=True)
examples = ['0.png']
def find_layout(image):
img = np.array(image)
result = table_engine(img)
# save_structure_res(result, save_folder,os.path.basename(img_path).split('.')[0])
output = []
for line in result:
line.pop('img')
print(line)
output.append(line)
return output
iface = gr.Interface(fn=find_layout, inputs=[gr.Image(type="pil")], outputs="text", examples=examples)
iface.launch()
|