Spaces:
Running
on
Zero
Running
on
Zero
adamelliotfields
commited on
Commit
•
b70fffe
1
Parent(s):
c70346f
Remove accordion menu
Browse files
app.css
CHANGED
@@ -15,9 +15,6 @@
|
|
15 |
width: auto;
|
16 |
margin-right: 4px;
|
17 |
}
|
18 |
-
.accordion .tabitem > div {
|
19 |
-
--block-border-width: 1px;
|
20 |
-
}
|
21 |
|
22 |
#embeddings .token {
|
23 |
border-radius: 4px;
|
@@ -33,7 +30,7 @@
|
|
33 |
overflow-y: auto;
|
34 |
}
|
35 |
.gallery, .gallery .grid-wrap {
|
36 |
-
height: calc(100vh -
|
37 |
max-height: none;
|
38 |
}
|
39 |
|
@@ -45,10 +42,6 @@
|
|
45 |
max-width: 42px;
|
46 |
}
|
47 |
|
48 |
-
.image-container {
|
49 |
-
max-height: calc(100vh - 480px);
|
50 |
-
}
|
51 |
-
|
52 |
#intro {
|
53 |
margin-bottom: 8px !important;
|
54 |
}
|
@@ -132,9 +125,11 @@
|
|
132 |
}
|
133 |
.tab-nav {
|
134 |
margin-bottom: 16px;
|
|
|
135 |
}
|
136 |
.tab-nav > button {
|
137 |
padding-bottom: 8px;
|
|
|
138 |
}
|
139 |
|
140 |
@keyframes spin {
|
|
|
15 |
width: auto;
|
16 |
margin-right: 4px;
|
17 |
}
|
|
|
|
|
|
|
18 |
|
19 |
#embeddings .token {
|
20 |
border-radius: 4px;
|
|
|
30 |
overflow-y: auto;
|
31 |
}
|
32 |
.gallery, .gallery .grid-wrap {
|
33 |
+
height: calc(100vh - 422px);
|
34 |
max-height: none;
|
35 |
}
|
36 |
|
|
|
42 |
max-width: 42px;
|
43 |
}
|
44 |
|
|
|
|
|
|
|
|
|
45 |
#intro {
|
46 |
margin-bottom: 8px !important;
|
47 |
}
|
|
|
125 |
}
|
126 |
.tab-nav {
|
127 |
margin-bottom: 16px;
|
128 |
+
flex-wrap: nowrap;
|
129 |
}
|
130 |
.tab-nav > button {
|
131 |
padding-bottom: 8px;
|
132 |
+
text-wrap: wrap;
|
133 |
}
|
134 |
|
135 |
@keyframes spin {
|
app.js
CHANGED
@@ -1,18 +1,4 @@
|
|
1 |
() =>{
|
2 |
-
const menu = document.querySelector("#menu");
|
3 |
-
const menuButton = menu.querySelector("button");
|
4 |
-
const content = document.querySelector("#content");
|
5 |
-
|
6 |
-
const updateMenu = () => {
|
7 |
-
const isOpen = menuButton.classList.contains("open");
|
8 |
-
content.style.display = isOpen ? "none" : "flex";
|
9 |
-
content.style.marginTop = isOpen ? "0" : "40px";
|
10 |
-
};
|
11 |
-
|
12 |
-
const observer = new MutationObserver(updateMenu);
|
13 |
-
observer.observe(menuButton, { attributes: true, attributeFilter: ["class"] });
|
14 |
-
updateMenu();
|
15 |
-
|
16 |
if (window.location.hostname.endsWith(".hf.space")) {
|
17 |
const hfHeader = document.getElementById("huggingface-space-header");
|
18 |
if (hfHeader) {
|
|
|
1 |
() =>{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
if (window.location.hostname.endsWith(".hf.space")) {
|
3 |
const hfHeader = document.getElementById("huggingface-space-header");
|
4 |
if (hfHeader) {
|
app.py
CHANGED
@@ -134,305 +134,305 @@ with gr.Blocks(
|
|
134 |
|
135 |
gr.HTML(read_file("./partials/intro.html"))
|
136 |
|
137 |
-
with gr.
|
138 |
-
|
139 |
-
|
140 |
-
label="Menu",
|
141 |
-
open=False,
|
142 |
-
):
|
143 |
-
with gr.Tabs():
|
144 |
-
with gr.TabItem("⚙️ Settings"):
|
145 |
with gr.Group():
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
)
|
151 |
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
)
|
187 |
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
show_label=False,
|
206 |
-
)
|
207 |
-
with gr.Group(elem_classes=["gap-0"]):
|
208 |
-
lora_2 = gr.Dropdown(
|
209 |
-
min_width=240,
|
210 |
-
label="LoRA #2",
|
211 |
-
value="none",
|
212 |
-
choices=[("None", "none")]
|
213 |
-
+ [
|
214 |
-
(lora["name"], lora_id)
|
215 |
-
for lora_id, lora in Config.CIVIT_LORAS.items()
|
216 |
-
],
|
217 |
-
)
|
218 |
-
lora_2_weight = gr.Slider(
|
219 |
-
value=0.0,
|
220 |
-
minimum=0.0,
|
221 |
-
maximum=1.0,
|
222 |
-
step=0.1,
|
223 |
-
show_label=False,
|
224 |
-
)
|
225 |
-
|
226 |
-
with gr.Row():
|
227 |
-
guidance_scale = gr.Slider(
|
228 |
-
value=Config.GUIDANCE_SCALE,
|
229 |
-
label="Guidance Scale",
|
230 |
-
minimum=1.0,
|
231 |
-
maximum=15.0,
|
232 |
-
step=0.1,
|
233 |
-
)
|
234 |
-
inference_steps = gr.Slider(
|
235 |
-
value=Config.INFERENCE_STEPS,
|
236 |
-
label="Inference Steps",
|
237 |
-
minimum=1,
|
238 |
-
maximum=50,
|
239 |
-
step=1,
|
240 |
-
)
|
241 |
-
deepcache_interval = gr.Slider(
|
242 |
-
value=Config.DEEPCACHE_INTERVAL,
|
243 |
-
label="DeepCache",
|
244 |
-
minimum=1,
|
245 |
-
maximum=4,
|
246 |
-
step=1,
|
247 |
-
)
|
248 |
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
height = gr.Slider(
|
258 |
-
value=Config.HEIGHT,
|
259 |
-
label="Height",
|
260 |
-
minimum=256,
|
261 |
-
maximum=768,
|
262 |
-
step=32,
|
263 |
-
)
|
264 |
-
aspect_ratio = gr.Dropdown(
|
265 |
-
value=f"{Config.WIDTH},{Config.HEIGHT}",
|
266 |
-
label="Aspect Ratio",
|
267 |
-
filterable=False,
|
268 |
-
choices=[
|
269 |
-
("Custom", None),
|
270 |
-
("4:7 (384x672)", "384,672"),
|
271 |
-
("7:9 (448x576)", "448,576"),
|
272 |
-
("1:1 (512x512)", "512,512"),
|
273 |
-
("9:7 (576x448)", "576,448"),
|
274 |
-
("7:4 (672x384)", "672,384"),
|
275 |
-
],
|
276 |
-
)
|
277 |
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
value=Config.SCALE,
|
295 |
-
label="Scale",
|
296 |
-
)
|
297 |
-
seed = gr.Number(
|
298 |
-
value=Config.SEED,
|
299 |
-
label="Seed",
|
300 |
-
minimum=-1,
|
301 |
-
maximum=(2**64) - 1,
|
302 |
-
)
|
303 |
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
)
|
310 |
-
use_taesd = gr.Checkbox(
|
311 |
-
elem_classes=["checkbox"],
|
312 |
-
label="Tiny VAE",
|
313 |
-
value=False,
|
314 |
-
)
|
315 |
-
use_freeu = gr.Checkbox(
|
316 |
-
elem_classes=["checkbox"],
|
317 |
-
label="FreeU",
|
318 |
-
value=False,
|
319 |
-
)
|
320 |
-
use_clip_skip = gr.Checkbox(
|
321 |
-
elem_classes=["checkbox"],
|
322 |
-
label="Clip skip",
|
323 |
-
value=False,
|
324 |
-
)
|
325 |
|
326 |
-
|
327 |
-
with gr.
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
)
|
|
|
|
|
|
|
|
|
|
|
344 |
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
)
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
|
|
|
|
362 |
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
minimum=0.0,
|
368 |
maximum=1.0,
|
369 |
step=0.1,
|
|
|
370 |
)
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
value=False,
|
382 |
)
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
|
|
|
|
387 |
)
|
388 |
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
|
|
410 |
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
436 |
|
437 |
random_btn.click(random_fn, inputs=[], outputs=[prompt], show_api=False)
|
438 |
|
@@ -513,7 +513,6 @@ with gr.Blocks(
|
|
513 |
triggers=[generate_btn.click, prompt.submit],
|
514 |
fn=generate_fn,
|
515 |
api_name="generate",
|
516 |
-
concurrency_limit=5,
|
517 |
outputs=[output_images],
|
518 |
inputs=[
|
519 |
prompt,
|
@@ -568,7 +567,7 @@ if __name__ == "__main__":
|
|
568 |
)
|
569 |
|
570 |
# https://www.gradio.app/docs/gradio/interface#interface-queue
|
571 |
-
demo.queue().launch(
|
572 |
server_name=args.server,
|
573 |
server_port=args.port,
|
574 |
)
|
|
|
134 |
|
135 |
gr.HTML(read_file("./partials/intro.html"))
|
136 |
|
137 |
+
with gr.Tabs():
|
138 |
+
with gr.TabItem("🏠 Text"):
|
139 |
+
with gr.Column():
|
|
|
|
|
|
|
|
|
|
|
140 |
with gr.Group():
|
141 |
+
output_images = gr.Gallery(
|
142 |
+
elem_classes=["gallery"],
|
143 |
+
show_share_button=False,
|
144 |
+
object_fit="cover",
|
145 |
+
interactive=False,
|
146 |
+
show_label=False,
|
147 |
+
label="Output",
|
148 |
+
format="png",
|
149 |
+
columns=2,
|
150 |
+
)
|
151 |
+
prompt = gr.Textbox(
|
152 |
+
placeholder="What do you want to see?",
|
153 |
+
autoscroll=False,
|
154 |
+
show_label=False,
|
155 |
+
label="Prompt",
|
156 |
+
max_lines=3,
|
157 |
+
lines=3,
|
158 |
)
|
159 |
|
160 |
+
# Buttons
|
161 |
+
with gr.Row():
|
162 |
+
generate_btn = gr.Button("Generate", variant="primary")
|
163 |
+
random_btn = gr.Button(
|
164 |
+
elem_classes=["icon-button", "popover"],
|
165 |
+
variant="secondary",
|
166 |
+
elem_id="random",
|
167 |
+
min_width=0,
|
168 |
+
value="🎲",
|
169 |
+
)
|
170 |
+
refresh_btn = gr.Button(
|
171 |
+
elem_classes=["icon-button", "popover"],
|
172 |
+
variant="secondary",
|
173 |
+
elem_id="refresh",
|
174 |
+
min_width=0,
|
175 |
+
value="🔄",
|
176 |
+
)
|
177 |
+
clear_btn = gr.ClearButton(
|
178 |
+
elem_classes=["icon-button", "popover"],
|
179 |
+
components=[output_images],
|
180 |
+
variant="secondary",
|
181 |
+
elem_id="clear",
|
182 |
+
min_width=0,
|
183 |
+
value="🗑️",
|
184 |
+
)
|
185 |
|
186 |
+
# img2img tab
|
187 |
+
with gr.TabItem("🖼️ Image"):
|
188 |
+
with gr.Group():
|
189 |
+
with gr.Row():
|
190 |
+
image_prompt = gr.Image(
|
191 |
+
show_share_button=False,
|
192 |
+
label="Initial Image",
|
193 |
+
min_width=320,
|
194 |
+
format="png",
|
195 |
+
type="pil",
|
196 |
+
)
|
197 |
+
ip_image_prompt = gr.Image(
|
198 |
+
show_share_button=False,
|
199 |
+
label="IP-Adapter Image",
|
200 |
+
min_width=320,
|
201 |
+
format="png",
|
202 |
+
type="pil",
|
203 |
+
)
|
|
|
204 |
|
205 |
+
with gr.Row():
|
206 |
+
image_select = gr.Dropdown(
|
207 |
+
info="Use an initial image from the gallery",
|
208 |
+
choices=[("None", -1)],
|
209 |
+
label="Gallery Image",
|
210 |
+
interactive=True,
|
211 |
+
filterable=False,
|
212 |
+
value=-1,
|
213 |
+
)
|
214 |
+
ip_image_select = gr.Dropdown(
|
215 |
+
info="Use an IP-Adapter image from the gallery",
|
216 |
+
label="Gallery Image (IP-Adapter)",
|
217 |
+
choices=[("None", -1)],
|
218 |
+
interactive=True,
|
219 |
+
filterable=False,
|
220 |
+
value=-1,
|
221 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
|
223 |
+
with gr.Row():
|
224 |
+
denoising_strength = gr.Slider(
|
225 |
+
value=Config.DENOISING_STRENGTH,
|
226 |
+
label="Denoising Strength",
|
227 |
+
minimum=0.0,
|
228 |
+
maximum=1.0,
|
229 |
+
step=0.1,
|
230 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
|
232 |
+
with gr.Row():
|
233 |
+
disable_image = gr.Checkbox(
|
234 |
+
elem_classes=["checkbox"],
|
235 |
+
label="Disable Initial Image",
|
236 |
+
value=False,
|
237 |
+
)
|
238 |
+
disable_ip_image = gr.Checkbox(
|
239 |
+
elem_classes=["checkbox"],
|
240 |
+
label="Disable IP-Adapter Image",
|
241 |
+
value=False,
|
242 |
+
)
|
243 |
+
ip_face = gr.Checkbox(
|
244 |
+
elem_classes=["checkbox"],
|
245 |
+
label="Use IP-Adapter Face",
|
246 |
+
value=False,
|
247 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
|
249 |
+
# img2img tab
|
250 |
+
with gr.TabItem("🎮 Control"):
|
251 |
+
gr.Markdown(
|
252 |
+
"[ControlNet](https://github.com/lllyasviel/ControlNet) with [preprocessors](https://github.com/huggingface/controlnet_aux) coming soon!"
|
253 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
|
255 |
+
with gr.TabItem("⚙️ Menu"):
|
256 |
+
with gr.Group():
|
257 |
+
negative_prompt = gr.Textbox(
|
258 |
+
value="nsfw+",
|
259 |
+
label="Negative Prompt",
|
260 |
+
lines=2,
|
261 |
+
)
|
262 |
+
|
263 |
+
with gr.Row():
|
264 |
+
model = gr.Dropdown(
|
265 |
+
choices=Config.MODELS,
|
266 |
+
filterable=False,
|
267 |
+
value=Config.MODEL,
|
268 |
+
label="Model",
|
269 |
+
min_width=240,
|
270 |
+
)
|
271 |
+
scheduler = gr.Dropdown(
|
272 |
+
choices=Config.SCHEDULERS.keys(),
|
273 |
+
value=Config.SCHEDULER,
|
274 |
+
elem_id="scheduler",
|
275 |
+
label="Scheduler",
|
276 |
+
filterable=False,
|
277 |
+
)
|
278 |
|
279 |
+
with gr.Row():
|
280 |
+
styles = json.loads(read_file("data/styles.json"))
|
281 |
+
style_ids = list(styles.keys())
|
282 |
+
style_ids = [sid for sid in style_ids if not sid.startswith("_")]
|
283 |
+
style = gr.Dropdown(
|
284 |
+
value=Config.STYLE,
|
285 |
+
label="Style",
|
286 |
+
min_width=240,
|
287 |
+
choices=[("None", "none")]
|
288 |
+
+ [(styles[sid]["name"], sid) for sid in style_ids],
|
289 |
+
)
|
290 |
+
embeddings = gr.Dropdown(
|
291 |
+
elem_id="embeddings",
|
292 |
+
label="Embeddings",
|
293 |
+
choices=[(f"<{e}>", e) for e in Config.EMBEDDINGS],
|
294 |
+
multiselect=True,
|
295 |
+
value=[Config.EMBEDDING],
|
296 |
+
min_width=240,
|
297 |
+
)
|
298 |
|
299 |
+
with gr.Row():
|
300 |
+
with gr.Group(elem_classes=["gap-0"]):
|
301 |
+
lora_1 = gr.Dropdown(
|
302 |
+
min_width=240,
|
303 |
+
label="LoRA #1",
|
304 |
+
value="none",
|
305 |
+
choices=[("None", "none")]
|
306 |
+
+ [
|
307 |
+
(lora["name"], lora_id)
|
308 |
+
for lora_id, lora in Config.CIVIT_LORAS.items()
|
309 |
+
],
|
310 |
+
)
|
311 |
+
lora_1_weight = gr.Slider(
|
312 |
+
value=0.0,
|
313 |
minimum=0.0,
|
314 |
maximum=1.0,
|
315 |
step=0.1,
|
316 |
+
show_label=False,
|
317 |
)
|
318 |
+
with gr.Group(elem_classes=["gap-0"]):
|
319 |
+
lora_2 = gr.Dropdown(
|
320 |
+
min_width=240,
|
321 |
+
label="LoRA #2",
|
322 |
+
value="none",
|
323 |
+
choices=[("None", "none")]
|
324 |
+
+ [
|
325 |
+
(lora["name"], lora_id)
|
326 |
+
for lora_id, lora in Config.CIVIT_LORAS.items()
|
327 |
+
],
|
|
|
328 |
)
|
329 |
+
lora_2_weight = gr.Slider(
|
330 |
+
value=0.0,
|
331 |
+
minimum=0.0,
|
332 |
+
maximum=1.0,
|
333 |
+
step=0.1,
|
334 |
+
show_label=False,
|
335 |
)
|
336 |
|
337 |
+
with gr.Row():
|
338 |
+
guidance_scale = gr.Slider(
|
339 |
+
value=Config.GUIDANCE_SCALE,
|
340 |
+
label="Guidance Scale",
|
341 |
+
minimum=1.0,
|
342 |
+
maximum=15.0,
|
343 |
+
step=0.1,
|
344 |
+
)
|
345 |
+
inference_steps = gr.Slider(
|
346 |
+
value=Config.INFERENCE_STEPS,
|
347 |
+
label="Inference Steps",
|
348 |
+
minimum=1,
|
349 |
+
maximum=50,
|
350 |
+
step=1,
|
351 |
+
)
|
352 |
+
deepcache_interval = gr.Slider(
|
353 |
+
value=Config.DEEPCACHE_INTERVAL,
|
354 |
+
label="DeepCache",
|
355 |
+
minimum=1,
|
356 |
+
maximum=4,
|
357 |
+
step=1,
|
358 |
+
)
|
359 |
|
360 |
+
with gr.Row():
|
361 |
+
width = gr.Slider(
|
362 |
+
value=Config.WIDTH,
|
363 |
+
label="Width",
|
364 |
+
minimum=256,
|
365 |
+
maximum=768,
|
366 |
+
step=32,
|
367 |
+
)
|
368 |
+
height = gr.Slider(
|
369 |
+
value=Config.HEIGHT,
|
370 |
+
label="Height",
|
371 |
+
minimum=256,
|
372 |
+
maximum=768,
|
373 |
+
step=32,
|
374 |
+
)
|
375 |
+
aspect_ratio = gr.Dropdown(
|
376 |
+
value=f"{Config.WIDTH},{Config.HEIGHT}",
|
377 |
+
label="Aspect Ratio",
|
378 |
+
filterable=False,
|
379 |
+
choices=[
|
380 |
+
("Custom", None),
|
381 |
+
("4:7 (384x672)", "384,672"),
|
382 |
+
("7:9 (448x576)", "448,576"),
|
383 |
+
("1:1 (512x512)", "512,512"),
|
384 |
+
("9:7 (576x448)", "576,448"),
|
385 |
+
("7:4 (672x384)", "672,384"),
|
386 |
+
],
|
387 |
+
)
|
388 |
+
|
389 |
+
with gr.Row():
|
390 |
+
file_format = gr.Dropdown(
|
391 |
+
choices=["png", "jpeg", "webp"],
|
392 |
+
label="File Format",
|
393 |
+
filterable=False,
|
394 |
+
value="png",
|
395 |
+
)
|
396 |
+
num_images = gr.Dropdown(
|
397 |
+
choices=list(range(1, 5)),
|
398 |
+
value=Config.NUM_IMAGES,
|
399 |
+
filterable=False,
|
400 |
+
label="Images",
|
401 |
+
)
|
402 |
+
scale = gr.Dropdown(
|
403 |
+
choices=[(f"{s}x", s) for s in Config.SCALES],
|
404 |
+
filterable=False,
|
405 |
+
value=Config.SCALE,
|
406 |
+
label="Scale",
|
407 |
+
)
|
408 |
+
seed = gr.Number(
|
409 |
+
value=Config.SEED,
|
410 |
+
label="Seed",
|
411 |
+
minimum=-1,
|
412 |
+
maximum=(2**64) - 1,
|
413 |
+
)
|
414 |
+
|
415 |
+
with gr.Row():
|
416 |
+
use_karras = gr.Checkbox(
|
417 |
+
elem_classes=["checkbox"],
|
418 |
+
label="Karras σ",
|
419 |
+
value=True,
|
420 |
+
)
|
421 |
+
use_taesd = gr.Checkbox(
|
422 |
+
elem_classes=["checkbox"],
|
423 |
+
label="Tiny VAE",
|
424 |
+
value=False,
|
425 |
+
)
|
426 |
+
use_freeu = gr.Checkbox(
|
427 |
+
elem_classes=["checkbox"],
|
428 |
+
label="FreeU",
|
429 |
+
value=False,
|
430 |
+
)
|
431 |
+
use_clip_skip = gr.Checkbox(
|
432 |
+
elem_classes=["checkbox"],
|
433 |
+
label="Clip skip",
|
434 |
+
value=False,
|
435 |
+
)
|
436 |
|
437 |
random_btn.click(random_fn, inputs=[], outputs=[prompt], show_api=False)
|
438 |
|
|
|
513 |
triggers=[generate_btn.click, prompt.submit],
|
514 |
fn=generate_fn,
|
515 |
api_name="generate",
|
|
|
516 |
outputs=[output_images],
|
517 |
inputs=[
|
518 |
prompt,
|
|
|
567 |
)
|
568 |
|
569 |
# https://www.gradio.app/docs/gradio/interface#interface-queue
|
570 |
+
demo.queue(default_concurrency_limit=1).launch(
|
571 |
server_name=args.server,
|
572 |
server_port=args.port,
|
573 |
)
|