leonelhs commited on
Commit
67d263e
·
1 Parent(s): a460d92

add examples

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -1,4 +1,5 @@
1
- # https://github.com/MarcoForte/FBA_Matting
 
2
  import cv2
3
  import gradio as gr
4
  import numpy as np
@@ -118,11 +119,14 @@ with gr.Blocks(title="FBA Matting") as app:
118
  run_btn.click(predict, [input_img, input_trimap], [fg, bg, alpha])
119
 
120
  with gr.Row():
121
- examples_data = [[f"examples/{x:02d}.jpg"] for x in range(1, 4)]
122
- examples = gr.Dataset(components=[input_img], samples=examples_data)
123
- examples.click(lambda x: x[0], [examples], [input_img])
 
 
124
 
125
  with gr.Row():
126
  gr.HTML(footer)
127
 
128
  app.launch(share=False, debug=True, enable_queue=True, show_error=True)
 
 
1
+ # demo source from: https://github.com/MarcoForte/FBA_Matting
2
+
3
  import cv2
4
  import gradio as gr
5
  import numpy as np
 
119
  run_btn.click(predict, [input_img, input_trimap], [fg, bg, alpha])
120
 
121
  with gr.Row():
122
+ blobs = [[
123
+ f"./images/{x:02d}.png",
124
+ f"./trimaps/{x:02d}.png"] for x in range(1, 7)]
125
+ examples = gr.Dataset(components=[input_img, input_trimap], samples=blobs)
126
+ examples.click(lambda x: (x[0], x[1]), [examples], [input_img, input_trimap])
127
 
128
  with gr.Row():
129
  gr.HTML(footer)
130
 
131
  app.launch(share=False, debug=True, enable_queue=True, show_error=True)
132
+