hanquansanren commited on
Commit
8d9577d
·
1 Parent(s): 720a202
Files changed (1) hide show
  1. app.py +30 -12
app.py CHANGED
@@ -377,18 +377,36 @@ model.eval()
377
 
378
 
379
  if __name__ == '__main__':
380
- demo = gr.Interface(
381
- fn=run_single_docunet,
382
- inputs=[
383
- gr.Image(type="pil", label="Input Image"),
384
- ],
385
- outputs=[
386
- gr.Image(type="numpy", label="Output Image"),
387
- ],
388
- title="Document Image Dewarping",
389
- description="This is a demo for SIGGRAPH Asia 2025 paper 'DvD: Unleashing a Generative Paradigm for Document Dewarping via Coordinates-based Diffusion Model' ",
390
- examples=EXAMPLES
391
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
392
 
393
  # demo.launch(share=True, debug=True, server_name="10.7.88.77")
394
  demo.launch(ssr_mode=False)
 
377
 
378
 
379
  if __name__ == '__main__':
380
+ # demo = gr.Interface(
381
+ # fn=run_single_docunet,
382
+ # inputs=[
383
+ # gr.Image(type="pil", label="Input Image"),
384
+ # ],
385
+ # outputs=[
386
+ # gr.Image(type="numpy", label="Output Image"),
387
+ # ],
388
+ # title="Document Image Dewarping",
389
+ # description="This is a demo for SIGGRAPH Asia 2025 paper 'DvD: Unleashing a Generative Paradigm for Document Dewarping via Coordinates-based Diffusion Model' ",
390
+ # examples=EXAMPLES
391
+ # )
392
+
393
+ with gr.Blocks() as demo:
394
+ gr.Markdown("## Document Image Dewarping Demo")
395
+
396
+ with gr.Row():
397
+ input_image = gr.Image(type="pil", label="Input Image")
398
+ output_image = gr.Image(type="numpy", label="Output Image")
399
+
400
+ # 加载 Examples 到输入框
401
+ gr.Examples(
402
+ examples=EXAMPLES,
403
+ inputs=[input_image],
404
+ label="Click an example to load into Input Image"
405
+ )
406
+
407
+ # 按钮运行函数
408
+ run_btn = gr.Button("Run")
409
+ run_btn.click(fn=run_single_docunet, inputs=[input_image], outputs=[output_image])
410
 
411
  # demo.launch(share=True, debug=True, server_name="10.7.88.77")
412
  demo.launch(ssr_mode=False)