Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -348,6 +348,65 @@ with gr.Blocks(theme='Hev832/Applio') as blocks:
|
|
| 348 |
type="pil",
|
| 349 |
)
|
| 350 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 351 |
|
| 352 |
with gr.Accordion("Advanced Art Controls", open=True):
|
| 353 |
with gr.Row():
|
|
@@ -461,66 +520,6 @@ with gr.Blocks(theme='Hev832/Applio') as blocks:
|
|
| 461 |
Try **-1** if you want to explore and generate different designs. If you find something you really love, write down the seed number and use it again to recreate the same design.
|
| 462 |
"""
|
| 463 |
)
|
| 464 |
-
|
| 465 |
-
with gr.Accordion("QR Code Customization", open=True):
|
| 466 |
-
bg_color = gr.ColorPicker(
|
| 467 |
-
label="Background Color",
|
| 468 |
-
value="#FFFFFF",
|
| 469 |
-
info="Choose the background color for the QR code"
|
| 470 |
-
)
|
| 471 |
-
qr_color = gr.ColorPicker(
|
| 472 |
-
label="QR Code Color",
|
| 473 |
-
value="#000000",
|
| 474 |
-
info="Choose the color for the QR code pattern"
|
| 475 |
-
)
|
| 476 |
-
invert_final_image = gr.Checkbox(
|
| 477 |
-
label="Invert Final Image",
|
| 478 |
-
value=False,
|
| 479 |
-
info="Check this to invert the colors of the final image",
|
| 480 |
-
visible=False,
|
| 481 |
-
)
|
| 482 |
-
with gr.Accordion("Model Selection", open=True):
|
| 483 |
-
controlnet_model_dropdown = gr.Dropdown(
|
| 484 |
-
choices=list(CONTROLNET_MODELS.keys()),
|
| 485 |
-
value="QR Code Monster",
|
| 486 |
-
label="ControlNet Model",
|
| 487 |
-
info="Select the ControlNet model for QR code generation"
|
| 488 |
-
)
|
| 489 |
-
diffusion_model_dropdown = gr.Dropdown(
|
| 490 |
-
choices=list(DIFFUSION_MODELS.keys()),
|
| 491 |
-
value="GhostMix",
|
| 492 |
-
label="Diffusion Model",
|
| 493 |
-
info="Select the main diffusion model for image generation"
|
| 494 |
-
)
|
| 495 |
-
|
| 496 |
-
with gr.Column():
|
| 497 |
-
result_image = gr.Image(label="Your Artistic QR Code")
|
| 498 |
-
used_seed = gr.Number(label="Seed Used", interactive=False)
|
| 499 |
-
|
| 500 |
-
with gr.Row(visible=False):
|
| 501 |
-
scan_button = gr.Button("Verify QR Code Works")
|
| 502 |
-
scan_result = gr.Textbox(label="Validation Result of QR Code", interactive=False)
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
gr.Markdown(
|
| 507 |
-
"""
|
| 508 |
-
### 🔍 Analyzing Your Creation
|
| 509 |
-
- Is the QR code scannable? Check with your phone camera to see if it can scan it.
|
| 510 |
-
- If not scannable, use the Brightness, Contrast, and Saturation sliders to optimize the QR code for scanning.
|
| 511 |
-
- Does the art style match your prompt? If not, try adjusting the 'Prompt Adherence'.
|
| 512 |
-
- Want more artistic flair? Increase the 'Artistic Freedom'.
|
| 513 |
-
- Need a clearer QR code? Raise the 'QR Code Visibility'.
|
| 514 |
-
"""
|
| 515 |
-
)
|
| 516 |
-
|
| 517 |
-
with gr.Row():
|
| 518 |
-
brightness = gr.Slider(minimum=0.1, maximum=2.0, step=0.1, value=1.0, label="Brightness")
|
| 519 |
-
contrast = gr.Slider(minimum=0.1, maximum=2.0, step=0.1, value=1.0, label="Contrast")
|
| 520 |
-
saturation = gr.Slider(minimum=0.1, maximum=2.0, step=0.1, value=1.0, label="Saturation")
|
| 521 |
-
with gr.Row():
|
| 522 |
-
invert_button = gr.Button("Invert Image")
|
| 523 |
-
|
| 524 |
|
| 525 |
def scan_and_display(image):
|
| 526 |
if image is None:
|
|
|
|
| 348 |
type="pil",
|
| 349 |
)
|
| 350 |
|
| 351 |
+
|
| 352 |
+
with gr.Accordion("Set Custom QR Code Colors", open=False):
|
| 353 |
+
bg_color = gr.ColorPicker(
|
| 354 |
+
label="Background Color",
|
| 355 |
+
value="#FFFFFF",
|
| 356 |
+
info="Choose the background color for the QR code"
|
| 357 |
+
)
|
| 358 |
+
qr_color = gr.ColorPicker(
|
| 359 |
+
label="QR Code Color",
|
| 360 |
+
value="#000000",
|
| 361 |
+
info="Choose the color for the QR code pattern"
|
| 362 |
+
)
|
| 363 |
+
invert_final_image = gr.Checkbox(
|
| 364 |
+
label="Invert Final Image",
|
| 365 |
+
value=False,
|
| 366 |
+
info="Check this to invert the colors of the final image",
|
| 367 |
+
visible=False,
|
| 368 |
+
)
|
| 369 |
+
with gr.Accordion("AI Model Selection", open=False):
|
| 370 |
+
controlnet_model_dropdown = gr.Dropdown(
|
| 371 |
+
choices=list(CONTROLNET_MODELS.keys()),
|
| 372 |
+
value="QR Code Monster",
|
| 373 |
+
label="ControlNet Model",
|
| 374 |
+
info="Select the ControlNet model for QR code generation"
|
| 375 |
+
)
|
| 376 |
+
diffusion_model_dropdown = gr.Dropdown(
|
| 377 |
+
choices=list(DIFFUSION_MODELS.keys()),
|
| 378 |
+
value="GhostMix",
|
| 379 |
+
label="Diffusion Model",
|
| 380 |
+
info="Select the main diffusion model for image generation"
|
| 381 |
+
)
|
| 382 |
+
|
| 383 |
+
with gr.Column():
|
| 384 |
+
result_image = gr.Image(label="Your Artistic QR Code")
|
| 385 |
+
used_seed = gr.Number(label="Seed Used", interactive=False)
|
| 386 |
+
|
| 387 |
+
with gr.Row(visible=False):
|
| 388 |
+
scan_button = gr.Button("Verify QR Code Works")
|
| 389 |
+
scan_result = gr.Textbox(label="Validation Result of QR Code", interactive=False)
|
| 390 |
+
|
| 391 |
+
|
| 392 |
+
|
| 393 |
+
gr.Markdown(
|
| 394 |
+
"""
|
| 395 |
+
### 🔍 Analyzing Your Creation
|
| 396 |
+
- Is the QR code scannable? Check with your phone camera to see if it can scan it.
|
| 397 |
+
- If not scannable, use the Brightness, Contrast, and Saturation sliders to optimize the QR code for scanning.
|
| 398 |
+
- Does the art style match your prompt? If not, try adjusting the 'Prompt Adherence'.
|
| 399 |
+
- Want more artistic flair? Increase the 'Artistic Freedom'.
|
| 400 |
+
- Need a clearer QR code? Raise the 'QR Code Visibility'.
|
| 401 |
+
"""
|
| 402 |
+
)
|
| 403 |
+
|
| 404 |
+
with gr.Row():
|
| 405 |
+
brightness = gr.Slider(minimum=0.1, maximum=2.0, step=0.1, value=1.0, label="Brightness")
|
| 406 |
+
contrast = gr.Slider(minimum=0.1, maximum=2.0, step=0.1, value=1.0, label="Contrast")
|
| 407 |
+
saturation = gr.Slider(minimum=0.1, maximum=2.0, step=0.1, value=1.0, label="Saturation")
|
| 408 |
+
with gr.Row():
|
| 409 |
+
invert_button = gr.Button("Invert Image")
|
| 410 |
|
| 411 |
with gr.Accordion("Advanced Art Controls", open=True):
|
| 412 |
with gr.Row():
|
|
|
|
| 520 |
Try **-1** if you want to explore and generate different designs. If you find something you really love, write down the seed number and use it again to recreate the same design.
|
| 521 |
"""
|
| 522 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 523 |
|
| 524 |
def scan_and_display(image):
|
| 525 |
if image is None:
|