pierreguillou commited on
Commit
ad083b6
1 Parent(s): b1e5912

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -4,25 +4,25 @@ import layoutparser as lp
4
  import gradio as gr
5
 
6
  # PubLayNet
7
- #model1 = lp.Detectron2LayoutModel('lp://PrimaLayout/faster_rcnn_R_50_FPN_3x/config')
8
- model2 = lp.Detectron2LayoutModel('lp://PrimaLayout/mask_rcnn_R_50_FPN_3x/config')
9
- model3 = lp.Detectron2LayoutModel('lp://PrimaLayout/mask_rcnn_X_101_32x8d_FPN_3x/config')
10
 
11
  def lpi(img):
12
  # You need to load the image somewhere else, e.g., image = cv2.imread(...)
13
- #layout1 = model1.detect(img)
14
  layout2 = model2.detect(img)
15
  layout3 = model3.detect(img)
16
 
17
- #img1 = lp.draw_box(img, layout1)
18
  img2 = lp.draw_box(img, layout2)
19
  img3 = lp.draw_box(img, layout3)
20
 
21
- return img2, img3 # With extra configurations
22
 
23
  inputs = gr.inputs.Image(type='pil', label="Original Image")
24
  outputs = [
25
- #gr.outputs.Image(type="pil",label="Output Image (faster_rcnn_R_50_FPN_3x)"),
26
  gr.outputs.Image(type="pil",label="Output Image (mask_rcnn_R_50_FPN_3x)"),
27
  gr.outputs.Image(type="pil",label="Output Image (mask_rcnn_X_101_32x8d_FPN_3x)")
28
  ]
 
4
  import gradio as gr
5
 
6
  # PubLayNet
7
+ model1 = lp.Detectron2LayoutModel('lp://PubLayNet/faster_rcnn_R_50_FPN_3x/config')
8
+ model2 = lp.Detectron2LayoutModel('lp://PubLayNet/mask_rcnn_R_50_FPN_3x/config')
9
+ model3 = lp.Detectron2LayoutModel('lp://PubLayNet/mask_rcnn_X_101_32x8d_FPN_3x/config')
10
 
11
  def lpi(img):
12
  # You need to load the image somewhere else, e.g., image = cv2.imread(...)
13
+ layout1 = model1.detect(img)
14
  layout2 = model2.detect(img)
15
  layout3 = model3.detect(img)
16
 
17
+ img1 = lp.draw_box(img, layout1)
18
  img2 = lp.draw_box(img, layout2)
19
  img3 = lp.draw_box(img, layout3)
20
 
21
+ return img1, img2, img3 # With extra configurations
22
 
23
  inputs = gr.inputs.Image(type='pil', label="Original Image")
24
  outputs = [
25
+ gr.outputs.Image(type="pil",label="Output Image (faster_rcnn_R_50_FPN_3x)"),
26
  gr.outputs.Image(type="pil",label="Output Image (mask_rcnn_R_50_FPN_3x)"),
27
  gr.outputs.Image(type="pil",label="Output Image (mask_rcnn_X_101_32x8d_FPN_3x)")
28
  ]