tokeron commited on
Commit
699be9a
·
verified ·
1 Parent(s): 36b2246

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -8,14 +8,16 @@ from diffusion_lens import get_images
8
  def generate_images(prompt):
9
  print('calling diffusion lens')
10
  all_images = [] # Initialize a list to store all images
11
- for skip_layers in range(11, 0, -1):
 
12
  images = get_images(prompt, skip_layers=skip_layers)
13
  all_images.append(images[0]) # Add the new image to the list
14
- yield all_images # Yield the list of all images
 
15
 
16
  with gr.Blocks() as demo:
17
  text_input = gr.Textbox(label="Enter prompt")
18
- gallery = gr.Gallery(label="Generated Images", columns=6, rows=2, object_fit="contain", height="auto")
19
  text_input.change(fn=generate_images, inputs=text_input, outputs=gallery)
20
 
21
  demo.launch()
 
8
  def generate_images(prompt):
9
  print('calling diffusion lens')
10
  all_images = [] # Initialize a list to store all images
11
+ all_labels = []
12
+ for skip_layers in range(12, -1, -1):
13
  images = get_images(prompt, skip_layers=skip_layers)
14
  all_images.append(images[0]) # Add the new image to the list
15
+ all_labels.append(f'layer_{12 - skip_layers}')
16
+ yield all_images, all_labels # Yield the list of all images
17
 
18
  with gr.Blocks() as demo:
19
  text_input = gr.Textbox(label="Enter prompt")
20
+ gallery = gr.Gallery(label="Generated Images", columns=7, rows=2, object_fit="contain", height="auto")
21
  text_input.change(fn=generate_images, inputs=text_input, outputs=gallery)
22
 
23
  demo.launch()