verkaDerkaDerk commited on
Commit
1b2a8d8
·
1 Parent(s): 5da5ea4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -8,16 +8,16 @@ MODEL_ID = "verkaDerkaDerk/tiki-64"
8
  PIPELINE = DDPMPipeline.from_pretrained(MODEL_ID)
9
 
10
 
11
- def imagineAll(batch_size=1):
12
- generator = torch.manual_seed(0)
13
- return pipeline(generator=generator, batch_size=batch_size)["sample"]
14
  return PIPELINE()["sample"]
15
 
16
  def imagine4():
17
- return imagineAll(4)
18
 
19
  def imagine():
20
- return imagineAll[0]
21
 
22
  def fancy():
23
  # try some https://huggingface.co/spaces/stabilityai/stable-diffusion/blob/main/app.py trix
@@ -54,8 +54,14 @@ def fancy():
54
  label="Generated images", show_label=False, elem_id="gallery"
55
  ).style(grid=[4], height="256")
56
 
57
- btn.click(imagine4, inputs=None, outputs=gallery)
58
 
 
 
 
 
 
 
59
  gr.HTML('''
60
  <p><img src="https://huggingface.co/spaces/verkaDerkaDerk/tiki-64/resolve/main/tiki-600e.png"></p>
61
 
@@ -75,7 +81,6 @@ def plain():
75
  - did this change make it to the front-end?
76
  '''
77
  article = gr.HTML('''
78
- <p><img src="blob/main/tiki-600e.png"></p>
79
  <p>Trained with <a href="https://github.com/huggingface/diffusers">diffusers</a>.</p>
80
  ''')
81
 
 
8
  PIPELINE = DDPMPipeline.from_pretrained(MODEL_ID)
9
 
10
 
11
+ def tiki(batch_size=1,seed=0):
12
+ generator = torch.manual_seed(seed)
13
+ return PIPELINE(generator=generator, batch_size=batch_size)["sample"]
14
  return PIPELINE()["sample"]
15
 
16
  def imagine4():
17
+ return tiki(batch_size=4)
18
 
19
  def imagine():
20
+ return tiki()[0]
21
 
22
  def fancy():
23
  # try some https://huggingface.co/spaces/stabilityai/stable-diffusion/blob/main/app.py trix
 
54
  label="Generated images", show_label=False, elem_id="gallery"
55
  ).style(grid=[4], height="256")
56
 
57
+ #btn.click(imagine4, inputs=None, outputs=gallery)
58
 
59
+ with gr.Row(elem_id="tiki-options"):
60
+ batch_size = gr.Slider(label="batch_size", minimum=1, maximum=4, value=4, step=1)
61
+ seed = gr.Slider(label="seed", minimum=0, maximum=2022, value=0, step=1)
62
+
63
+ btn.click(tiki, inputs=[batch_size,seed], outputs=gallery)
64
+
65
  gr.HTML('''
66
  <p><img src="https://huggingface.co/spaces/verkaDerkaDerk/tiki-64/resolve/main/tiki-600e.png"></p>
67
 
 
81
  - did this change make it to the front-end?
82
  '''
83
  article = gr.HTML('''
 
84
  <p>Trained with <a href="https://github.com/huggingface/diffusers">diffusers</a>.</p>
85
  ''')
86