Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
import os
|
2 |
import sys
|
3 |
-
# sys.path.append(os.path.abspath(os.path.dirname(os.getcwd())))
|
4 |
# os.chdir("../")
|
5 |
import gradio as gr
|
6 |
import numpy as np
|
@@ -9,10 +8,8 @@ from matplotlib import pyplot as plt
|
|
9 |
import torch
|
10 |
import tempfile
|
11 |
from lama_inpaint import inpaint_img_with_lama, build_lama_model, inpaint_img_with_builded_lama
|
12 |
-
#from utils import load_img_to_array, save_array_to_img, dilate_mask, \
|
13 |
-
# show_mask, show_points
|
14 |
from PIL import Image
|
15 |
-
sys.path.insert(0, str(Path(__file__).resolve().parent / "third_party" / "segment-anything"))
|
16 |
import argparse
|
17 |
|
18 |
import os
|
@@ -39,7 +36,7 @@ coco_metadata = MetadataCatalog.get("coco_2017_val")
|
|
39 |
from detectron2_repo.projects.PointRend import point_rend
|
40 |
|
41 |
|
42 |
-
title = "PeopleRemover"
|
43 |
description = """
|
44 |
In this space, you can remove the amount of people you want from a picture.
|
45 |
⚠️ This is just a demo version!
|
@@ -132,6 +129,7 @@ model['lama'] = build_lama_model(lama_config, lama_ckpt, device=device)
|
|
132 |
|
133 |
|
134 |
with gr.Blocks() as demo:
|
|
|
135 |
gr.Markdown(description)
|
136 |
features = gr.State(None)
|
137 |
|
@@ -164,6 +162,18 @@ with gr.Blocks() as demo:
|
|
164 |
[img, features, img_out],
|
165 |
[img, features, img_out]
|
166 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
|
168 |
if __name__ == "__main__":
|
169 |
demo.launch()
|
|
|
1 |
import os
|
2 |
import sys
|
|
|
3 |
# os.chdir("../")
|
4 |
import gradio as gr
|
5 |
import numpy as np
|
|
|
8 |
import torch
|
9 |
import tempfile
|
10 |
from lama_inpaint import inpaint_img_with_lama, build_lama_model, inpaint_img_with_builded_lama
|
|
|
|
|
11 |
from PIL import Image
|
12 |
+
#sys.path.insert(0, str(Path(__file__).resolve().parent / "third_party" / "segment-anything"))
|
13 |
import argparse
|
14 |
|
15 |
import os
|
|
|
36 |
from detectron2_repo.projects.PointRend import point_rend
|
37 |
|
38 |
|
39 |
+
title = "# PeopleRemover"
|
40 |
description = """
|
41 |
In this space, you can remove the amount of people you want from a picture.
|
42 |
⚠️ This is just a demo version!
|
|
|
129 |
|
130 |
|
131 |
with gr.Blocks() as demo:
|
132 |
+
gr.Markdown(title)
|
133 |
gr.Markdown(description)
|
134 |
features = gr.State(None)
|
135 |
|
|
|
162 |
[img, features, img_out],
|
163 |
[img, features, img_out]
|
164 |
)
|
165 |
+
[img, num_people_keep, dilate_kernel_size],
|
166 |
+
[img_out]
|
167 |
+
gr.Examples(
|
168 |
+
examples=[os.path.join(os.path.dirname(__file__), "examples/002.jpg"),
|
169 |
+
os.path.join(os.path.dirname(__file__), "examples/013.jpg"),
|
170 |
+
os.path.join(os.path.dirname(__file__), "examples/014.jpg"),
|
171 |
+
os.path.join(os.path.dirname(__file__), "examples/015.jpg")]
|
172 |
+
inputs=img,
|
173 |
+
outputs=img_out,
|
174 |
+
fn=mirror,
|
175 |
+
cache_examples=True,
|
176 |
+
)
|
177 |
|
178 |
if __name__ == "__main__":
|
179 |
demo.launch()
|