Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -58,13 +58,13 @@ model_num_of_layers = {
|
|
58 |
}
|
59 |
|
60 |
|
61 |
-
def generate_images(prompt, model, seed):
|
62 |
seed = random.randint(0, MAX_SEED) if seed == -1 else seed
|
63 |
print('calling diffusion lens with model:', model, 'and seed:', seed)
|
64 |
gr.Info('Generating images from intermediate layers..')
|
65 |
all_images = [] # Initialize a list to store all images
|
66 |
max_num_of_layers = model_num_of_layers[model]
|
67 |
-
for skip_layers in range(max_num_of_layers - 1, -1, -1):
|
68 |
# Pass the model and seed to the get_images function
|
69 |
images = get_images(prompt, skip_layers=skip_layers, model=model, seed=seed)
|
70 |
all_images.append((images[0], f'layer_{max_num_of_layers - skip_layers}'))
|
@@ -106,10 +106,19 @@ with gr.Blocks() as demo:
|
|
106 |
label="Seed Value",
|
107 |
)
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
inputs = [
|
110 |
prompt,
|
111 |
model,
|
112 |
seed,
|
|
|
113 |
]
|
114 |
|
115 |
|
|
|
58 |
}
|
59 |
|
60 |
|
61 |
+
def generate_images(prompt, model, seed, skip):
|
62 |
seed = random.randint(0, MAX_SEED) if seed == -1 else seed
|
63 |
print('calling diffusion lens with model:', model, 'and seed:', seed)
|
64 |
gr.Info('Generating images from intermediate layers..')
|
65 |
all_images = [] # Initialize a list to store all images
|
66 |
max_num_of_layers = model_num_of_layers[model]
|
67 |
+
for skip_layers in range(max_num_of_layers - 1, -1, -1 * skip):
|
68 |
# Pass the model and seed to the get_images function
|
69 |
images = get_images(prompt, skip_layers=skip_layers, model=model, seed=seed)
|
70 |
all_images.append((images[0], f'layer_{max_num_of_layers - skip_layers}'))
|
|
|
106 |
label="Seed Value",
|
107 |
)
|
108 |
|
109 |
+
skip = gr.Slider(
|
110 |
+
minimum=0,
|
111 |
+
maximum=6,
|
112 |
+
value=4,
|
113 |
+
step=1,
|
114 |
+
label="Number of layers to skip between each generaion",
|
115 |
+
)
|
116 |
+
|
117 |
inputs = [
|
118 |
prompt,
|
119 |
model,
|
120 |
seed,
|
121 |
+
skip,
|
122 |
]
|
123 |
|
124 |
|