Spaces:
Runtime error
Runtime error
fast inference
Browse files
app.py
CHANGED
|
@@ -71,7 +71,7 @@ def get_inpainted_img(img, mask0, mask1, mask2):
|
|
| 71 |
if len(mask.shape)==3:
|
| 72 |
mask = mask[:,:,0]
|
| 73 |
img_inpainted = inpaint_img_with_builded_lama(
|
| 74 |
-
|
| 75 |
out.append(img_inpainted)
|
| 76 |
return out
|
| 77 |
|
|
@@ -104,7 +104,7 @@ with gr.Blocks() as demo:
|
|
| 104 |
with gr.Row():
|
| 105 |
w = gr.Number(label="Point Coordinate W")
|
| 106 |
h = gr.Number(label="Point Coordinate H")
|
| 107 |
-
sam_feat = gr.Button("
|
| 108 |
sam_mask = gr.Button("Predict Mask Using SAM")
|
| 109 |
lama = gr.Button("Inpaint Image Using LaMA")
|
| 110 |
|
|
@@ -138,11 +138,12 @@ with gr.Blocks() as demo:
|
|
| 138 |
return evt.index[0], evt.index[1], fig
|
| 139 |
|
| 140 |
img.select(get_select_coords, [img], [w, h, img_pointed])
|
| 141 |
-
sam_feat.click(
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
)
|
|
|
|
| 146 |
sam_mask.click(
|
| 147 |
get_masked_img,
|
| 148 |
[img, w, h],
|
|
|
|
| 71 |
if len(mask.shape)==3:
|
| 72 |
mask = mask[:,:,0]
|
| 73 |
img_inpainted = inpaint_img_with_builded_lama(
|
| 74 |
+
model['lama'], img, mask, lama_config, device=device)
|
| 75 |
out.append(img_inpainted)
|
| 76 |
return out
|
| 77 |
|
|
|
|
| 104 |
with gr.Row():
|
| 105 |
w = gr.Number(label="Point Coordinate W")
|
| 106 |
h = gr.Number(label="Point Coordinate H")
|
| 107 |
+
# sam_feat = gr.Button("Prepare for Segmentation")
|
| 108 |
sam_mask = gr.Button("Predict Mask Using SAM")
|
| 109 |
lama = gr.Button("Inpaint Image Using LaMA")
|
| 110 |
|
|
|
|
| 138 |
return evt.index[0], evt.index[1], fig
|
| 139 |
|
| 140 |
img.select(get_select_coords, [img], [w, h, img_pointed])
|
| 141 |
+
# sam_feat.click(
|
| 142 |
+
# get_sam_feat,
|
| 143 |
+
# [img],
|
| 144 |
+
# []
|
| 145 |
+
# )
|
| 146 |
+
img.change(get_sam_feat, [img], [])
|
| 147 |
sam_mask.click(
|
| 148 |
get_masked_img,
|
| 149 |
[img, w, h],
|