import gradio as gr from rapid_unwrap.inference import DocUnwrapper # 初始化模型 model_path = "models/uvdoc.onnx" doc_unwrapper = DocUnwrapper(model_path=model_path) # 添加示例 example_images = [ "images/demo1.jpg", "images/demo1.png", "images/demo2.png", "images/demo3.jpg", ] def process_image(img_path): unwrapped_img, elapse = doc_unwrapper(img_path) print(f"doc unwrap elapse: {elapse}") return unwrapped_img def main(): # 定义Gradio界面 with gr.Blocks(css=""" .scrollable-container { overflow-x: auto; white-space: nowrap; } .header-links { text-align: center; } .header-links a { display: inline-block; text-align: center; margin-right: 10px; /* 调整间距 */ } """) as demo: gr.HTML( "