Haobo Yuan commited on
Commit
0172a4c
1 Parent(s): b9f6971

add some examples

Browse files
assets/000000000139.jpg ADDED

Git LFS Details

  • SHA256: ffe0f0cec3b2e27aab1967229cdf0a0d7751dcdd5800322f0b8ac0dffb3b8a8d
  • Pointer size: 131 Bytes
  • Size of remote file: 162 kB
assets/000000000285.jpg ADDED

Git LFS Details

  • SHA256: f3a2974ce3686332609124c70e3e6a2e3aca43fccf1cd1bd7c5c03820977f57d
  • Pointer size: 131 Bytes
  • Size of remote file: 336 kB
assets/000000000632.jpg ADDED

Git LFS Details

  • SHA256: a4cd7f45ac1ce27eaafb254b23af7c0b18a064be08870ceaaf03b2147f2ce550
  • Pointer size: 131 Bytes
  • Size of remote file: 156 kB
assets/000000000724.jpg ADDED

Git LFS Details

  • SHA256: 5c0e559c75d3969c8e3e297b61f61063f78045c9d4802b526ba616361f3823fd
  • Pointer size: 131 Bytes
  • Size of remote file: 130 kB
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],