Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -58,6 +58,9 @@ model_num_of_layers = {
|
|
| 58 |
'Stable Diffusion 2.1': 22,
|
| 59 |
}
|
| 60 |
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
def generate_images(prompt, model, seed, skip):
|
| 63 |
seed = random.randint(0, MAX_SEED) if seed == -1 else seed
|
|
@@ -109,11 +112,11 @@ with gr.Blocks() as demo:
|
|
| 109 |
)
|
| 110 |
|
| 111 |
skip = gr.Slider(
|
| 112 |
-
minimum=
|
| 113 |
maximum=6,
|
| 114 |
-
value=
|
| 115 |
step=1,
|
| 116 |
-
label="
|
| 117 |
)
|
| 118 |
|
| 119 |
inputs = [
|
|
@@ -145,6 +148,33 @@ with gr.Blocks() as demo:
|
|
| 145 |
show_api=False,
|
| 146 |
trigger_mode="always_last",
|
| 147 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
|
| 149 |
gr.Markdown(article)
|
| 150 |
|
|
|
|
| 58 |
'Stable Diffusion 2.1': 22,
|
| 59 |
}
|
| 60 |
|
| 61 |
+
def run_for_examples(prompt, model, seed, skip):
|
| 62 |
+
return generate_images(prompt, model, seed, skip);
|
| 63 |
+
|
| 64 |
|
| 65 |
def generate_images(prompt, model, seed, skip):
|
| 66 |
seed = random.randint(0, MAX_SEED) if seed == -1 else seed
|
|
|
|
| 112 |
)
|
| 113 |
|
| 114 |
skip = gr.Slider(
|
| 115 |
+
minimum=1,
|
| 116 |
maximum=6,
|
| 117 |
+
value=3,
|
| 118 |
step=1,
|
| 119 |
+
label="# Layers to Skip Between Generations",
|
| 120 |
)
|
| 121 |
|
| 122 |
inputs = [
|
|
|
|
| 148 |
show_api=False,
|
| 149 |
trigger_mode="always_last",
|
| 150 |
)
|
| 151 |
+
examples = [
|
| 152 |
+
[
|
| 153 |
+
"A photo of an Aye-aye.",
|
| 154 |
+
"Stable Diffusion 2.1"
|
| 155 |
+
"1",
|
| 156 |
+
"1"
|
| 157 |
+
],
|
| 158 |
+
[
|
| 159 |
+
"A photo of an Beagle.",
|
| 160 |
+
"Stable Diffusion 2.1"
|
| 161 |
+
"1",
|
| 162 |
+
"1"
|
| 163 |
+
],
|
| 164 |
+
[
|
| 165 |
+
"A green cat and a blue dog.",
|
| 166 |
+
"Stable Diffusion 2.1"
|
| 167 |
+
"1",
|
| 168 |
+
"1"
|
| 169 |
+
],
|
| 170 |
+
|
| 171 |
+
gr.Examples(
|
| 172 |
+
examples=examples,
|
| 173 |
+
inputs = [prompt, model, seed, skip]
|
| 174 |
+
fn=run_for_examples,
|
| 175 |
+
outputs=[generated_image],
|
| 176 |
+
cache_examples=True,
|
| 177 |
+
)
|
| 178 |
|
| 179 |
gr.Markdown(article)
|
| 180 |
|