omer11a commited on
Commit
58ad0e0
·
1 Parent(s): 77e9eec

Added another example

Browse files
Files changed (1) hide show
  1. app.py +24 -11
app.py CHANGED
@@ -19,22 +19,28 @@ MIN_SIZE = 0.01
19
  WHITE = 255
20
  COLORS = ["red", "blue", "green", "orange", "purple", "turquoise", "olive"]
21
 
22
- PROMPT1 = "3D Pixar animation of a cute unicorn and a pink hedgehog and a nerdy owl traveling in a magical forest"
23
- PROMPT2 = "science fiction movie poster with an astronaut and a robot and a green alien and a spaceship"
24
- PROMPT3 = "a golden retriever and a german shepherd and a boston terrier and an english bulldog and a border collie in a pool"
 
25
  EXAMPLE_BOXES = {
26
- PROMPT1 : [
27
  [0.35, 0.4, 0.65, 0.9],
28
  [0, 0.6, 0.3, 0.9],
29
  [0.7, 0.55, 1, 0.85]
30
  ],
31
- PROMPT2: [
32
  [0.4, 0.45, 0.6, 0.95],
33
  [0.2, 0.3, 0.4, 0.85],
34
  [0.6, 0.3, 0.8, 0.85],
35
  [0.1, 0, 0.9, 0.3]
36
  ],
37
- PROMPT3: [
 
 
 
 
 
38
  [0, 0.5, 0.2, 0.8],
39
  [0.2, 0.2, 0.4, 0.5],
40
  [0.4, 0.5, 0.6, 0.8],
@@ -97,7 +103,8 @@ COPY_LINK = """
97
  <a href="https://huggingface.co/spaces/omer11a/bounded-attention?duplicate=true">
98
  <img src="https://bit.ly/3gLdBN6" alt="Duplicate Space">
99
  </a>
100
- Duplicate this space to generate more samples without waiting in queue
 
101
  """
102
  ADVANCED_OPTION_DESCRIPTION = """
103
  <div class="tooltip" >Number of guidance steps &#9432
@@ -195,7 +202,7 @@ def inference(
195
  return model(prompts, latents=start_code, guidance_scale=classifier_free_guidance_scale).images
196
 
197
 
198
- @spaces.GPU(duration=350)
199
  def generate(
200
  prompt,
201
  subject_token_indices,
@@ -392,19 +399,25 @@ def main():
392
  #inputs=[prompt, subject_token_indices, filter_token_indices, num_tokens],
393
  examples=[
394
  [
395
- PROMPT1, "7,8,17;11,12,17;15,16,17", "5,6,9,10,13,14,18,19", "21",
396
  25, 18, 3, 1, 1,
397
  7.5, 1, 5, 0.2, 8,
398
  286,
399
  ],
400
  [
401
- PROMPT2, "7;10;13,14;17", "5,6,8,9,11,12,15,16", "17",
402
  18, 12, 3, 1, 1,
403
  7.5, 1, 5, 0.2, 8,
404
  216,
405
  ],
406
  [
407
- PROMPT3, "2,3;6,7;10,11;14,15;18,19", "1,4,5,8,9,12,13,16,17,20,21", "22",
 
 
 
 
 
 
408
  18, 12, 3, 1, 1,
409
  7.5, 1, 5, 0.2, 8,
410
  156,
 
19
  WHITE = 255
20
  COLORS = ["red", "blue", "green", "orange", "purple", "turquoise", "olive"]
21
 
22
+ PROMPT2 = "3 D Pixar animation of a cute unicorn and a pink hedgehog and a nerdy owl traveling in a magical forest"
23
+ PROMPT3 = "science fiction movie poster with an astronaut and a robot and a green alien and a spaceship"
24
+ PROMPT4 = "a realistic photo of a highway with a semi trailer and a concrete mixer and a helicopter"
25
+ PROMPT5 = "a golden retriever and a german shepherd and a boston terrier and an english bulldog and a border collie in a pool"
26
  EXAMPLE_BOXES = {
27
+ PROMPT2 : [
28
  [0.35, 0.4, 0.65, 0.9],
29
  [0, 0.6, 0.3, 0.9],
30
  [0.7, 0.55, 1, 0.85]
31
  ],
32
+ PROMPT3: [
33
  [0.4, 0.45, 0.6, 0.95],
34
  [0.2, 0.3, 0.4, 0.85],
35
  [0.6, 0.3, 0.8, 0.85],
36
  [0.1, 0, 0.9, 0.3]
37
  ],
38
+ PROMPT4: [
39
+ [0.05, 0.5, 0.45, 0.85],
40
+ [0.55, 0.6, 0.95, 0.85],
41
+ [0.3, 0.2, 0.7, 0.45],
42
+ ],
43
+ PROMPT5: [
44
  [0, 0.5, 0.2, 0.8],
45
  [0.2, 0.2, 0.4, 0.5],
46
  [0.4, 0.5, 0.6, 0.8],
 
103
  <a href="https://huggingface.co/spaces/omer11a/bounded-attention?duplicate=true">
104
  <img src="https://bit.ly/3gLdBN6" alt="Duplicate Space">
105
  </a>
106
+ Duplicate this space to generate more samples without waiting in queue.
107
+ To get better results, use our code on your own GPU and increase the number of guidance steps to 15.
108
  """
109
  ADVANCED_OPTION_DESCRIPTION = """
110
  <div class="tooltip" >Number of guidance steps &#9432
 
202
  return model(prompts, latents=start_code, guidance_scale=classifier_free_guidance_scale).images
203
 
204
 
205
+ @spaces.GPU(duration=340)
206
  def generate(
207
  prompt,
208
  subject_token_indices,
 
399
  #inputs=[prompt, subject_token_indices, filter_token_indices, num_tokens],
400
  examples=[
401
  [
402
+ PROMPT2, "7,8,17;11,12,17;15,16,17", "5,6,9,10,13,14,18,19", "21",
403
  25, 18, 3, 1, 1,
404
  7.5, 1, 5, 0.2, 8,
405
  286,
406
  ],
407
  [
408
+ PROMPT3, "7;10;13,14;17", "5,6,8,9,11,12,15,16", "17",
409
  18, 12, 3, 1, 1,
410
  7.5, 1, 5, 0.2, 8,
411
  216,
412
  ],
413
  [
414
+ PROMPT4, "9,10;13,14;17", "1,4,5,7,8,11,12,15,16", "17",
415
+ 25, 18, 3, 1, 1,
416
+ 7.5, 1, 5, 0.2, 8,
417
+ 86,
418
+ ],
419
+ [
420
+ PROMPT5, "2,3;6,7;10,11;14,15;18,19", "1,4,5,8,9,12,13,16,17,20,21", "22",
421
  18, 12, 3, 1, 1,
422
  7.5, 1, 5, 0.2, 8,
423
  156,