Spaces:
Runtime error
Runtime error
| 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() | |