fffiloni commited on
Commit
d7cd35e
β€’
1 Parent(s): 2908c5f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -23,10 +23,11 @@ def ask(input_im, scale, steps, seed, images):
23
  images.append(image)
24
  return images
25
 
26
- def main(input_im, scale, steps, seed):
27
 
28
  images = []
29
- for i in range(2):
 
30
  images = ask(input_im, scale, steps, seed, images)
31
  #images = ask(input_im, scale, steps, seed, images)
32
  #images = ask(input_im, scale, steps, seed, images)
@@ -42,6 +43,7 @@ pipe = pipe.to(device)
42
 
43
  inputs = [
44
  gr.Image(),
 
45
  gr.Slider(0, 25, value=3, step=1, label="Guidance scale"),
46
  gr.Slider(5, 50, value=25, step=5, label="Steps"),
47
  gr.Slider(label = "Seed", minimum = 0, maximum = 2147483647, step = 1, randomize = True)
@@ -51,12 +53,14 @@ output.style(grid=2, height="")
51
 
52
  description = \
53
  """
54
- <p style='text-align: center;'>This demo is running on CPU. Working version fixed by Sylvain <a href='https://twitter.com/fffiloni' target='_blank'>@fffiloni</a>. You'll get 4 images variations. NSFW filters enabled. <img id='visitor-badge' alt='visitor badge' src='https://visitor-badge.glitch.me/badge?page_id=gradio-blocks.sd-img-variations' style='display: inline-block' /><br />
 
 
55
  Generate variations on an input image using a fine-tuned version of Stable Diffusion.<br />
56
  Trained by <a href='https://www.justinpinkney.com' target='_blank'>Justin Pinkney</a> (<a href='https://twitter.com/Buntworthy' target='_blank'>@Buntworthy</a>) at <a href='https://lambdalabs.com/' target='_blank'>Lambda</a><br />
57
  This version has been ported to πŸ€— Diffusers library, see more details on how to use this version in the <a href='https://github.com/LambdaLabsML/lambda-diffusers' target='_blank'>Lambda Diffusers repo</a>.<br />
58
  For the original training code see <a href='https://github.com/justinpinkney/stable-diffusion' target='_blank'>this repo</a>.
59
- <img src='https://raw.githubusercontent.com/justinpinkney/stable-diffusion/main/assets/im-vars-thin.jpg' />
60
  </p>
61
  """
62
 
 
23
  images.append(image)
24
  return images
25
 
26
+ def main(input_im, n_pairs, scale, steps, seed):
27
 
28
  images = []
29
+ for i in range(n_pairs):
30
+ print('Asking for a new pair of image [' + str(i) + '/' + str(n_pairs) + ']')
31
  images = ask(input_im, scale, steps, seed, images)
32
  #images = ask(input_im, scale, steps, seed, images)
33
  #images = ask(input_im, scale, steps, seed, images)
 
43
 
44
  inputs = [
45
  gr.Image(),
46
+ gr.Slider(0, 3, value=2, step=1, label="Pairs of images to ask"),
47
  gr.Slider(0, 25, value=3, step=1, label="Guidance scale"),
48
  gr.Slider(5, 50, value=25, step=5, label="Steps"),
49
  gr.Slider(label = "Seed", minimum = 0, maximum = 2147483647, step = 1, randomize = True)
 
53
 
54
  description = \
55
  """
56
+ <p style='text-align: center;'>This demo is running on CPU. Working version fixed by Sylvain <a href='https://twitter.com/fffiloni' target='_blank'>@fffiloni</a>. You'll get n pairs of images variations. <br />
57
+ Asking for pairs of images instead of more than 2 images in a row helps us to avoid heavy CPU load and connection error out ;)<br />
58
+ Waiting time (for 2 pairs): ~5/10 minutes β€’ NSFW filters enabled β€’ <img id='visitor-badge' alt='visitor badge' src='https://visitor-badge.glitch.me/badge?page_id=gradio-blocks.sd-img-variations' style='display: inline-block' /><br />
59
  Generate variations on an input image using a fine-tuned version of Stable Diffusion.<br />
60
  Trained by <a href='https://www.justinpinkney.com' target='_blank'>Justin Pinkney</a> (<a href='https://twitter.com/Buntworthy' target='_blank'>@Buntworthy</a>) at <a href='https://lambdalabs.com/' target='_blank'>Lambda</a><br />
61
  This version has been ported to πŸ€— Diffusers library, see more details on how to use this version in the <a href='https://github.com/LambdaLabsML/lambda-diffusers' target='_blank'>Lambda Diffusers repo</a>.<br />
62
  For the original training code see <a href='https://github.com/justinpinkney/stable-diffusion' target='_blank'>this repo</a>.
63
+ <img src='https://raw.githubusercontent.com/justinpinkney/stable-diffusion/main/assets/im-vars-thin.jpg' style='display: inline-block;' />
64
  </p>
65
  """
66