omer11a commited on
Commit
5368ac9
·
1 Parent(s): b322d0b

Removed examples

Browse files
Files changed (1) hide show
  1. app.py +4 -64
app.py CHANGED
@@ -18,30 +18,6 @@ MIN_SIZE = 0.01
18
  WHITE = 255
19
  COLORS = ["red", "blue", "green", "orange", "purple", "turquoise", "olive"]
20
 
21
- PROMPT1 = "3D Pixar animation of a cute unicorn and a pink hedgehog and a nerdy owl traveling in a magical forest"
22
- PROMPT2 = "science fiction movie poster with an astronaut and a robot and a green alien and a spaceship"
23
- PROMPT3 = "a golden retriever and a german shepherd and a boston terrier and an english bulldog and a border collie in a pool"
24
- EXAMPLE_BOXES = {
25
- PROMPT1 : [
26
- [0.35, 0.4, 0.65, 0.9],
27
- [0, 0.6, 0.3, 0.9],
28
- [0.7, 0.55, 1, 0.85]
29
- ],
30
- PROMPT2: [
31
- [0.4, 0.45, 0.6, 0.95],
32
- [0.2, 0.3, 0.4, 0.85],
33
- [0.6, 0.3, 0.8, 0.85],
34
- [0.1, 0, 0.9, 0.3]
35
- ],
36
- PROMPT3: [
37
- [0, 0.5, 0.2, 0.8],
38
- [0.2, 0.2, 0.4, 0.5],
39
- [0.4, 0.5, 0.6, 0.8],
40
- [0.6, 0.2, 0.8, 0.5],
41
- [0.8, 0.5, 1, 0.8]
42
- ],
43
- }
44
-
45
  DESCRIPTION = """
46
  <p style="text-align: center; font-weight: bold;">
47
  <span style="font-size: 28px">Bounded Attention</span>
@@ -203,13 +179,6 @@ def clear(batch_size):
203
  return [[], None, None, None]
204
 
205
 
206
- def make_example_inputs(prompt):
207
- boxes = EXAMPLE_BOXES[prompt]
208
- sketchpad = draw_boxes(boxes, is_sketch=True)
209
- layout_image = draw_boxes(boxes)
210
- return sketchpad, layout_image, prompt
211
-
212
-
213
  def main():
214
  css = """
215
  #paper-info a {
@@ -278,8 +247,8 @@ def main():
278
  )
279
 
280
  with gr.Row():
281
- sketchpad = gr.Sketchpad(label="Sketch Pad (draw each bounding box in a different layer)", width=RESOLUTION, height=RESOLUTION)
282
- layout_image = gr.Image(type="pil", label="Bounding Boxes", interactive=False, width=RESOLUTION, height=RESOLUTION, scale=1)
283
 
284
  with gr.Row():
285
  clear_button = gr.Button(value="Clear")
@@ -367,37 +336,8 @@ def main():
367
 
368
  with gr.Column():
369
  gr.Examples(
370
- examples=[
371
- [
372
- *make_example_inputs(PROMPT1),
373
- "7,8,17;11,12,17;15,16,17", "5,6,9,10,13,14,18,19", "21",
374
- 25, 10, 3, 1, 1,
375
- 7.5, 1, 5, 0.2, 15,
376
- 286,
377
- ],
378
- [
379
- *make_example_inputs(PROMPT2),
380
- "7;10;13,14;17", "5,6,8,9,11,12,15,16", "17",
381
- 18, 5, 3, 1, 1,
382
- 7.5, 1, 5, 0.2, 15,
383
- 216,
384
- ],
385
- [
386
- *make_example_inputs(PROMPT3),
387
- "2,3;6,7;10,11;14,15;18,19", "1,4,5,8,9,12,13,16,17,20,21", "22",
388
- 18, 5, 3, 1, 1,
389
- 7.5, 1, 5, 0.2, 15,
390
- 156,
391
- ],
392
- ],
393
- inputs=[
394
- sketchpad, layout_image,
395
- prompt, subject_token_indices, filter_token_indices, num_tokens,
396
- init_step_size, final_step_size, num_clusters_per_subject, cross_loss_scale, self_loss_scale,
397
- classifier_free_guidance_scale, batch_size, num_iterations, loss_threshold, num_guidance_steps,
398
- seed,
399
- ],
400
- outputs=[boxes, sketchpad, layout_image, out_images],
401
  )
402
 
403
  gr.HTML(FOOTNOTE)
 
18
  WHITE = 255
19
  COLORS = ["red", "blue", "green", "orange", "purple", "turquoise", "olive"]
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  DESCRIPTION = """
22
  <p style="text-align: center; font-weight: bold;">
23
  <span style="font-size: 28px">Bounded Attention</span>
 
179
  return [[], None, None, None]
180
 
181
 
 
 
 
 
 
 
 
182
  def main():
183
  css = """
184
  #paper-info a {
 
247
  )
248
 
249
  with gr.Row():
250
+ sketchpad = gr.Sketchpad(label="Sketch Pad (draw each bounding box in a different layer)")
251
+ layout_image = gr.Image(type="pil", label="Bounding Boxes", interactive=False)
252
 
253
  with gr.Row():
254
  clear_button = gr.Button(value="Clear")
 
336
 
337
  with gr.Column():
338
  gr.Examples(
339
+ examples=[["a ginger kitten and a gray puppy in a yard", "2,3;6,7", "1,4,5,8,9", "10"]],
340
+ inputs=[prompt, subject_token_indices, filter_token_indices, num_tokens],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
341
  )
342
 
343
  gr.HTML(FOOTNOTE)