Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -365,122 +365,122 @@ examples = [
|
|
| 365 |
]
|
| 366 |
|
| 367 |
css = '''
|
| 368 |
-
.gradio-container{max-width:
|
| 369 |
h1{text-align:center}
|
| 370 |
'''
|
| 371 |
|
| 372 |
with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
|
| 373 |
with gr.Row():
|
| 374 |
with gr.Column(scale=1):
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
max_lines=1,
|
| 379 |
-
placeholder="Enter your prompt",
|
| 380 |
-
container=False,
|
| 381 |
-
)
|
| 382 |
-
run_button = gr.Button("Generate as ( 1024 x 1024 )", scale=0)
|
| 383 |
-
|
| 384 |
-
with gr.Row(visible=True):
|
| 385 |
-
grid_size_selection = gr.Dropdown(
|
| 386 |
-
choices=["2x1", "1x2", "2x2", "2x3", "3x2", "1x1"],
|
| 387 |
-
value="1x1",
|
| 388 |
-
label="Grid Size"
|
| 389 |
-
)
|
| 390 |
-
|
| 391 |
-
with gr.Row(visible=True):
|
| 392 |
-
filter_selection = gr.Dropdown(
|
| 393 |
-
show_label=True,
|
| 394 |
-
container=True,
|
| 395 |
-
interactive=True,
|
| 396 |
-
choices=FILTER_NAMES,
|
| 397 |
-
value=DEFAULT_FILTER_NAME,
|
| 398 |
-
label="Filter Type",
|
| 399 |
-
)
|
| 400 |
-
|
| 401 |
-
with gr.Row(visible=True):
|
| 402 |
-
collage_style_selection = gr.Dropdown(
|
| 403 |
-
show_label=True,
|
| 404 |
-
container=True,
|
| 405 |
-
interactive=True,
|
| 406 |
-
choices=COLLAGE_STYLE_NAMES,
|
| 407 |
-
value=DEFAULT_COLLAGE_STYLE_NAME,
|
| 408 |
-
label="Collage Template + Duotone Canvas",
|
| 409 |
-
)
|
| 410 |
-
|
| 411 |
-
with gr.Row(visible=True):
|
| 412 |
-
style_selection = gr.Dropdown(
|
| 413 |
-
show_label=True,
|
| 414 |
-
container=True,
|
| 415 |
-
interactive=True,
|
| 416 |
-
choices=STYLE_NAMES,
|
| 417 |
-
value=DEFAULT_STYLE_NAME,
|
| 418 |
-
label="Quality Style",
|
| 419 |
-
)
|
| 420 |
-
|
| 421 |
-
with gr.Accordion("Advanced options", open=False):
|
| 422 |
-
use_negative_prompt = gr.Checkbox(label="Use negative prompt", value=True, visible=True)
|
| 423 |
-
negative_prompt = gr.Text(
|
| 424 |
-
label="Negative prompt",
|
| 425 |
max_lines=1,
|
| 426 |
-
placeholder="Enter
|
| 427 |
-
|
| 428 |
-
visible=True,
|
| 429 |
)
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
)
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
|
|
|
|
|
|
|
| 445 |
)
|
| 446 |
-
|
| 447 |
-
label="Seed",
|
| 448 |
-
minimum=0,
|
| 449 |
-
maximum=MAX_SEED,
|
| 450 |
-
step=1,
|
| 451 |
-
value=0,
|
| 452 |
-
visible=True
|
| 453 |
-
)
|
| 454 |
-
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
| 455 |
-
|
| 456 |
with gr.Row(visible=True):
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
value=
|
|
|
|
| 463 |
)
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
|
|
|
|
|
|
|
|
|
| 470 |
)
|
| 471 |
-
|
| 472 |
-
with gr.
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
value=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 479 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 480 |
|
| 481 |
with gr.Column(scale=2):
|
| 482 |
result = gr.Gallery(label="Result", columns=1, show_label=False)
|
| 483 |
-
|
| 484 |
gr.Examples(
|
| 485 |
examples=examples,
|
| 486 |
inputs=prompt,
|
|
@@ -488,7 +488,7 @@ with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
|
|
| 488 |
fn=generate,
|
| 489 |
cache_examples=CACHE_EXAMPLES,
|
| 490 |
)
|
| 491 |
-
|
| 492 |
use_negative_prompt.change(
|
| 493 |
fn=lambda x: gr.update(visible=x),
|
| 494 |
inputs=use_negative_prompt,
|
|
|
|
| 365 |
]
|
| 366 |
|
| 367 |
css = '''
|
| 368 |
+
.gradio-container{max-width: 888px !important}
|
| 369 |
h1{text-align:center}
|
| 370 |
'''
|
| 371 |
|
| 372 |
with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
|
| 373 |
with gr.Row():
|
| 374 |
with gr.Column(scale=1):
|
| 375 |
+
prompt = gr.Text(
|
| 376 |
+
label="Prompt",
|
| 377 |
+
show_label=False,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 378 |
max_lines=1,
|
| 379 |
+
placeholder="Enter your prompt",
|
| 380 |
+
container=False,
|
|
|
|
| 381 |
)
|
| 382 |
+
run_button = gr.Button("Generate as ( 1024 x 1024 )", scale=0)
|
| 383 |
+
|
| 384 |
+
with gr.Row(visible=True):
|
| 385 |
+
grid_size_selection = gr.Dropdown(
|
| 386 |
+
choices=["2x1", "1x2", "2x2", "2x3", "3x2", "1x1"],
|
| 387 |
+
value="1x1",
|
| 388 |
+
label="Grid Size"
|
| 389 |
)
|
| 390 |
+
|
| 391 |
+
with gr.Row(visible=True):
|
| 392 |
+
filter_selection = gr.Dropdown(
|
| 393 |
+
show_label=True,
|
| 394 |
+
container=True,
|
| 395 |
+
interactive=True,
|
| 396 |
+
choices=FILTER_NAMES,
|
| 397 |
+
value=DEFAULT_FILTER_NAME,
|
| 398 |
+
label="Filter Type",
|
| 399 |
)
|
| 400 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 401 |
with gr.Row(visible=True):
|
| 402 |
+
collage_style_selection = gr.Dropdown(
|
| 403 |
+
show_label=True,
|
| 404 |
+
container=True,
|
| 405 |
+
interactive=True,
|
| 406 |
+
choices=COLLAGE_STYLE_NAMES,
|
| 407 |
+
value=DEFAULT_COLLAGE_STYLE_NAME,
|
| 408 |
+
label="Collage Template + Duotone Canvas",
|
| 409 |
)
|
| 410 |
+
|
| 411 |
+
with gr.Row(visible=True):
|
| 412 |
+
style_selection = gr.Dropdown(
|
| 413 |
+
show_label=True,
|
| 414 |
+
container=True,
|
| 415 |
+
interactive=True,
|
| 416 |
+
choices=STYLE_NAMES,
|
| 417 |
+
value=DEFAULT_STYLE_NAME,
|
| 418 |
+
label="Quality Style",
|
| 419 |
)
|
| 420 |
+
|
| 421 |
+
with gr.Accordion("Advanced options", open=False):
|
| 422 |
+
use_negative_prompt = gr.Checkbox(label="Use negative prompt", value=True, visible=True)
|
| 423 |
+
negative_prompt = gr.Text(
|
| 424 |
+
label="Negative prompt",
|
| 425 |
+
max_lines=1,
|
| 426 |
+
placeholder="Enter a negative prompt",
|
| 427 |
+
value="(deformed, distorted, disfigured:1.3), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers:1.4), disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation",
|
| 428 |
+
visible=True,
|
| 429 |
+
)
|
| 430 |
+
with gr.Row():
|
| 431 |
+
num_inference_steps = gr.Slider(
|
| 432 |
+
label="Steps",
|
| 433 |
+
minimum=10,
|
| 434 |
+
maximum=60,
|
| 435 |
+
step=1,
|
| 436 |
+
value=30,
|
| 437 |
+
)
|
| 438 |
+
with gr.Row():
|
| 439 |
+
num_images_per_prompt = gr.Slider(
|
| 440 |
+
label="Images",
|
| 441 |
+
minimum=1,
|
| 442 |
+
maximum=5,
|
| 443 |
+
step=1,
|
| 444 |
+
value=2,
|
| 445 |
+
)
|
| 446 |
+
seed = gr.Slider(
|
| 447 |
+
label="Seed",
|
| 448 |
+
minimum=0,
|
| 449 |
+
maximum=MAX_SEED,
|
| 450 |
+
step=1,
|
| 451 |
+
value=0,
|
| 452 |
+
visible=True
|
| 453 |
)
|
| 454 |
+
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
| 455 |
+
|
| 456 |
+
with gr.Row(visible=True):
|
| 457 |
+
width = gr.Slider(
|
| 458 |
+
label="Width",
|
| 459 |
+
minimum=512,
|
| 460 |
+
maximum=2048,
|
| 461 |
+
step=64,
|
| 462 |
+
value=1024,
|
| 463 |
+
)
|
| 464 |
+
height = gr.Slider(
|
| 465 |
+
label="Height",
|
| 466 |
+
minimum=512,
|
| 467 |
+
maximum=2048,
|
| 468 |
+
step=64,
|
| 469 |
+
value=1024,
|
| 470 |
+
)
|
| 471 |
+
|
| 472 |
+
with gr.Row():
|
| 473 |
+
guidance_scale = gr.Slider(
|
| 474 |
+
label="Guidance Scale",
|
| 475 |
+
minimum=0.1,
|
| 476 |
+
maximum=20.0,
|
| 477 |
+
step=0.1,
|
| 478 |
+
value=6,
|
| 479 |
+
)
|
| 480 |
|
| 481 |
with gr.Column(scale=2):
|
| 482 |
result = gr.Gallery(label="Result", columns=1, show_label=False)
|
| 483 |
+
|
| 484 |
gr.Examples(
|
| 485 |
examples=examples,
|
| 486 |
inputs=prompt,
|
|
|
|
| 488 |
fn=generate,
|
| 489 |
cache_examples=CACHE_EXAMPLES,
|
| 490 |
)
|
| 491 |
+
|
| 492 |
use_negative_prompt.change(
|
| 493 |
fn=lambda x: gr.update(visible=x),
|
| 494 |
inputs=use_negative_prompt,
|