Haobo Yuan
commited on
Commit
•
0172a4c
1
Parent(s):
b9f6971
add some examples
Browse files- assets/000000000139.jpg +3 -0
- assets/000000000285.jpg +3 -0
- assets/000000000632.jpg +3 -0
- assets/000000000724.jpg +3 -0
- main.py +21 -0
assets/000000000139.jpg
ADDED
Git LFS Details
|
assets/000000000285.jpg
ADDED
Git LFS Details
|
assets/000000000632.jpg
ADDED
Git LFS Details
|
assets/000000000724.jpg
ADDED
Git LFS Details
|
main.py
CHANGED
@@ -31,6 +31,14 @@ mean = torch.tensor([123.675, 116.28, 103.53], device=device)[:, None, None]
|
|
31 |
std = torch.tensor([58.395, 57.12, 57.375], device=device)[:, None, None]
|
32 |
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
class IMGState:
|
35 |
def __init__(self):
|
36 |
self.img = None
|
@@ -158,8 +166,21 @@ def register_point_mode():
|
|
158 |
with gr.Row():
|
159 |
with gr.Column():
|
160 |
segment_btn = gr.Button("Segment", variant="primary")
|
|
|
161 |
clean_btn = gr.Button("Clean Prompts", variant="secondary")
|
162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
img_p.upload(
|
164 |
store_img,
|
165 |
[img_p, img_state],
|
|
|
31 |
std = torch.tensor([58.395, 57.12, 57.375], device=device)[:, None, None]
|
32 |
|
33 |
|
34 |
+
examples = [
|
35 |
+
["assets/000000000139.jpg"],
|
36 |
+
["assets/000000000285.jpg"],
|
37 |
+
["assets/000000000632.jpg"],
|
38 |
+
["assets/000000000724.jpg"],
|
39 |
+
]
|
40 |
+
|
41 |
+
|
42 |
class IMGState:
|
43 |
def __init__(self):
|
44 |
self.img = None
|
|
|
166 |
with gr.Row():
|
167 |
with gr.Column():
|
168 |
segment_btn = gr.Button("Segment", variant="primary")
|
169 |
+
with gr.Column():
|
170 |
clean_btn = gr.Button("Clean Prompts", variant="secondary")
|
171 |
|
172 |
+
with gr.Row():
|
173 |
+
with gr.Column():
|
174 |
+
gr.Markdown("Try some of the examples below ⬇️")
|
175 |
+
gr.Examples(
|
176 |
+
examples=examples,
|
177 |
+
inputs=[img_p, img_state],
|
178 |
+
outputs=[img_p, segm_p],
|
179 |
+
examples_per_page=4,
|
180 |
+
fn=store_img,
|
181 |
+
run_on_click=True
|
182 |
+
)
|
183 |
+
|
184 |
img_p.upload(
|
185 |
store_img,
|
186 |
[img_p, img_state],
|