Oysiyl commited on
Commit
58a4bdb
·
1 Parent(s): faa27af

adjust description, tabs reordering, remove text baes examples from artistic tab

Browse files
Files changed (1) hide show
  1. app.py +405 -546
app.py CHANGED
@@ -1029,35 +1029,37 @@ if __name__ == "__main__" and not os.environ.get('QR_TESTING_MODE'):
1029
  - **Copy/paste settings**: After generation, copy the JSON settings string that appears below the image and paste it into "Import Settings from JSON" to reproduce exact results or share with others
1030
 
1031
  ### Two Modes:
1032
- - **Standard QR**: Stable, accurate QR code generation (faster, more scannable, less creative)
1033
- - **Artistic QR**: More artistic and creative results with upscaling (slower, more creative, less scannable)
1034
 
1035
  ### Note:
 
 
1036
  Feel free to share your suggestions or feedback on how to improve the app! Thanks!
1037
  """)
1038
 
1039
  # Add tabs for different generation methods
1040
  with gr.Tabs():
1041
- # STANDARD QR TAB
1042
- with gr.TabItem("Standard QR"):
1043
  with gr.Row():
1044
  with gr.Column():
1045
- # Add input type selector
1046
- input_type = gr.Radio(
1047
  choices=["URL", "Plain Text"],
1048
  value="URL",
1049
  label="Input Type",
1050
  info="URL: For web links (auto-removes https://). Plain Text: For VCARD, WiFi, calendar, location, etc. (no manipulation)"
1051
  )
1052
 
1053
- # Add inputs
1054
- prompt_input = gr.Textbox(
1055
  label="Prompt",
1056
  placeholder="Describe the image you want to generate (check examples below for inspiration)",
1057
  value="Enter your prompt here... For example: 'a beautiful sunset over mountains, photorealistic, detailed landscape'",
1058
  lines=3
1059
  )
1060
- text_input = gr.Textbox(
1061
  label="QR Code Content",
1062
  placeholder="Enter URL or plain text",
1063
  value="Enter your URL or text here... For example: https://github.com",
@@ -1067,63 +1069,63 @@ if __name__ == "__main__" and not os.environ.get('QR_TESTING_MODE'):
1067
  # Import Settings section - separate accordion
1068
  with gr.Accordion("Import Settings from JSON", open=False):
1069
  gr.Markdown("Paste a settings JSON string (copied from a previous generation) to load all parameters at once.")
1070
- import_json_input_standard = gr.Textbox(
1071
  label="Paste Settings JSON",
1072
- placeholder='{"pipeline": "standard", "prompt": "...", "seed": 718313, ...}',
1073
  lines=3
1074
  )
1075
- import_status_standard = gr.Textbox(
1076
  label="Import Status",
1077
  interactive=False,
1078
  visible=False,
1079
  lines=2
1080
  )
1081
  with gr.Row():
1082
- load_settings_btn_standard = gr.Button("Load Settings", variant="primary")
1083
- clear_json_btn_standard = gr.Button("Clear", variant="secondary")
1084
 
1085
  # Change Settings Manually - separate accordion
1086
  with gr.Accordion("Change Settings Manually", open=False):
1087
- # Add image size slider
1088
- image_size = gr.Slider(
1089
  minimum=512,
1090
  maximum=1024,
1091
  step=64,
1092
- value=512,
1093
  label="Image Size",
1094
- info="Base size of the generated image. Final output will be 2x this size (e.g., 5121024) due to the two-step enhancement process. Higher values use more VRAM and take longer to process."
1095
  )
1096
 
1097
- # Add border size slider
1098
- border_size = gr.Slider(
1099
  minimum=0,
1100
  maximum=8,
1101
  step=1,
1102
- value=4,
1103
  label="QR Code Border Size",
1104
  info="Number of modules (squares) to use as border around the QR code. Higher values add more whitespace."
1105
  )
1106
 
1107
- # Add error correction dropdown
1108
- error_correction = gr.Dropdown(
1109
  choices=["Low (7%)", "Medium (15%)", "Quartile (25%)", "High (30%)"],
1110
- value="Medium (15%)",
1111
  label="Error Correction Level",
1112
- info="Higher error correction makes the QR code more scannable when damaged or obscured, but increases its size and complexity. Medium (15%) is a good starting point for most uses."
1113
  )
1114
 
1115
- # Add module size slider
1116
- module_size = gr.Slider(
1117
  minimum=4,
1118
  maximum=16,
1119
  step=1,
1120
- value=12,
1121
  label="QR Module Size",
1122
- info="Pixel width of the smallest QR code unit. Larger values improve readability but require a larger image size. 12 is a good starting point."
1123
  )
1124
 
1125
- # Add module drawer dropdown with style examples
1126
- module_drawer = gr.Dropdown(
1127
  choices=["Square", "Gapped Square", "Circle", "Rounded", "Vertical bars", "Horizontal bars"],
1128
  value="Square",
1129
  label="QR Code Style",
@@ -1158,260 +1160,305 @@ if __name__ == "__main__" and not os.environ.get('QR_TESTING_MODE'):
1158
  gr.Image("custom_nodes/ComfyQR/img/horizontal-bars.png", width=100, show_label=False, show_download_button=False)
1159
 
1160
  # Add upscale checkbox
1161
- enable_upscale = gr.Checkbox(
1162
  label="Enable Upscaling",
1163
- value=False,
1164
- info="Enable upscaling with RealESRGAN for higher quality output (disabled by default for standard pipeline)"
1165
- )
1166
-
1167
- # Add FreeU checkbox
1168
- enable_freeu_standard = gr.Checkbox(
1169
- label="Enable FreeU",
1170
- value=False,
1171
- info="Enable FreeU quality enhancement (disabled by default for standard pipeline)"
1172
  )
1173
 
1174
- # Add seed controls
1175
- use_custom_seed = gr.Checkbox(
1176
  label="Use Custom Seed",
1177
  value=True,
1178
  info="Enable to use a specific seed for reproducible results"
1179
  )
1180
- seed = gr.Slider(
1181
  minimum=0,
1182
  maximum=2000000,
1183
  step=1,
1184
  value=718313,
1185
  label="Seed",
1186
- visible=True, # Initially visible since use_custom_seed=True
1187
  info="Seed value for reproducibility. Same seed with same settings will produce the same result."
1188
  )
1189
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1190
  # ControlNet Strength Parameters
1191
  gr.Markdown("### ControlNet Strength (QR Code Preservation)")
1192
  gr.Markdown("**IMPORTANT:** Lower values preserve QR structure better (more scannable). Higher values create more artistic effects but may reduce scannability.")
1193
- controlnet_strength_standard_first = gr.Slider(
1194
  minimum=0.0,
1195
  maximum=1.0,
1196
  step=0.05,
1197
  value=0.45,
1198
- label="First Pass Strength (Brightness + Tile)",
1199
- info="Controls how much the AI modifies the QR in both ControlNet passes. LOWER = more scannable, HIGHER = more artistic. Try 0.35-0.50 for good balance. Default: 0.45"
1200
  )
1201
- controlnet_strength_standard_final = gr.Slider(
1202
  minimum=0.0,
1203
  maximum=1.0,
1204
  step=0.05,
1205
- value=1.0,
1206
- label="Final Pass Strength (Tile Refinement)",
1207
- info="Controls the final tile ControlNet pass strength. Usually kept at 1.0 for clarity. Default: 1.0"
1208
  )
1209
 
1210
- # The generate button
1211
- generate_btn = gr.Button("Generate Standard QR", variant="primary")
1212
 
1213
  with gr.Column():
1214
- # The output image
1215
- output_image = gr.Image(label="Generated Standard QR Code")
1216
- error_message = gr.Textbox(
1217
  label="Status / Errors",
1218
  interactive=False,
1219
  lines=3,
1220
  )
1221
  # Wrap settings output in accordion (initially hidden)
1222
- with gr.Accordion("Shareable Settings (JSON)", open=True, visible=False) as settings_accordion_standard:
1223
- settings_output_standard = gr.Textbox(
1224
  label="Copy this JSON to share your exact settings",
1225
  interactive=True,
1226
  lines=5,
1227
  show_copy_button=True
1228
  )
1229
 
1230
- # When clicking the button, it will trigger the main function
1231
- generate_btn.click(
1232
- fn=generate_standard_qr,
1233
- inputs=[prompt_input, text_input, input_type, image_size, border_size, error_correction, module_size, module_drawer, use_custom_seed, seed, enable_upscale, enable_freeu_standard, controlnet_strength_standard_first, controlnet_strength_standard_final],
1234
- outputs=[output_image, error_message, settings_output_standard, settings_accordion_standard]
1235
  )
1236
 
1237
  # Load Settings button event handler
1238
- load_settings_btn_standard.click(
1239
- fn=load_settings_from_json_standard,
1240
- inputs=[import_json_input_standard],
1241
  outputs=[
1242
- prompt_input,
1243
- text_input,
1244
- input_type,
1245
- image_size,
1246
- border_size,
1247
- error_correction,
1248
- module_size,
1249
- module_drawer,
1250
- use_custom_seed,
1251
- seed,
1252
- enable_upscale,
1253
- enable_freeu_standard,
1254
- controlnet_strength_standard_first,
1255
- controlnet_strength_standard_final,
1256
- import_status_standard
 
 
 
 
 
 
 
1257
  ]
1258
  )
1259
 
1260
- # Clear button event handler
1261
- clear_json_btn_standard.click(
1262
  fn=lambda: ("", gr.update(visible=False)),
1263
  inputs=[],
1264
- outputs=[import_json_input_standard, import_status_standard]
1265
  )
1266
 
1267
- # Seed slider visibility toggle
1268
- use_custom_seed.change(
1269
  fn=lambda x: gr.update(visible=x),
1270
- inputs=[use_custom_seed],
1271
- outputs=[seed]
1272
  )
1273
 
1274
- # Add examples
1275
- examples = [
1276
- [
1277
- "some clothes spread on ropes, realistic, great details, out in the open air sunny day realistic, great details,absence of people, Detailed and Intricate, CGI, Photoshoot,rim light, 8k, 16k, ultra detail",
1278
- "https://www.google.com",
1279
- "URL",
1280
- 512,
1281
- 4,
1282
- "Medium (15%)",
1283
- 12,
1284
- "Square"
1285
- ],
1286
- [
1287
- "some cards on poker tale, realistic, great details, realistic, great details,absence of people, Detailed and Intricate, CGI, Photoshoot,rim light, 8k, 16k, ultra detail",
1288
- "https://store.steampowered.com",
1289
- "URL",
1290
- 512,
1291
- 4,
1292
- "Medium (15%)",
1293
- 12,
1294
- "Square"
1295
- ],
1296
- [
1297
- "a beautiful sunset over mountains, photorealistic, detailed landscape, golden hour, dramatic lighting, 8k, ultra detailed",
1298
- "https://github.com",
1299
- "URL",
1300
- 512,
1301
- 4,
1302
- "Medium (15%)",
1303
- 12,
1304
- "Square"
1305
- ],
1306
- [
1307
- "underwater scene with coral reef and tropical fish, photorealistic, detailed, crystal clear water, sunlight rays, 8k, ultra detailed",
1308
- "https://twitter.com",
1309
- "URL",
1310
- 512,
1311
- 4,
1312
- "Medium (15%)",
1313
- 12,
1314
- "Square"
1315
- ],
1316
- [
1317
- "futuristic cityscape with flying cars and neon lights, cyberpunk style, detailed architecture, night scene, 8k, ultra detailed",
1318
- "https://linkedin.com",
1319
- "URL",
1320
- 512,
1321
- 4,
1322
- "Medium (15%)",
1323
- 12,
1324
- "Square"
1325
- ],
1326
- [
1327
- "vintage camera on wooden table, photorealistic, detailed textures, soft lighting, bokeh background, 8k, ultra detailed",
1328
- "https://instagram.com",
1329
- "URL",
1330
- 512,
1331
- 4,
1332
- "Medium (15%)",
1333
- 12,
1334
- "Square"
1335
- ],
1336
- [
1337
- "business card design, professional, modern, clean layout, corporate style, detailed, 8k, ultra detailed",
1338
- "BEGIN:VCARD\nVERSION:3.0\nFN:John Doe\nORG:Acme Corporation\nTITLE:Software Engineer\nTEL:+1-555-123-4567\nEMAIL:john.doe@example.com\nEND:VCARD",
1339
- "Plain Text",
1340
- 832,
1341
- 4,
1342
- "Medium (15%)",
1343
- 12,
1344
- "Square"
1345
- ],
1346
- [
1347
- "wifi network symbol, modern tech, digital art, glowing blue, detailed, 8k, ultra detailed",
1348
- "WIFI:T:WPA;S:MyNetwork;P:MyPassword123;;",
1349
- "Plain Text",
1350
- 576,
1351
- 4,
1352
- "Medium (15%)",
1353
- 12,
1354
- "Square"
1355
- ],
1356
- [
1357
- "calendar appointment reminder, organized planner, professional office, detailed, 8k, ultra detailed",
1358
- "BEGIN:VEVENT\nSUMMARY:Team Meeting\nDTSTART:20251115T140000Z\nDTEND:20251115T150000Z\nLOCATION:Conference Room A\nEND:VEVENT",
1359
- "Plain Text",
1360
- 832,
1361
- 4,
1362
- "Medium (15%)",
1363
- 12,
1364
- "Square"
1365
- ],
1366
- [
1367
- "location pin on map, travel destination, scenic view, detailed cartography, 8k, ultra detailed",
1368
- "geo:37.7749,-122.4194",
1369
- "Plain Text",
1370
- 512,
1371
- 4,
1372
- "Medium (15%)",
1373
- 12,
1374
- "Square"
1375
- ]
1376
- ]
1377
 
1378
- gr.Examples(
1379
- examples=examples,
1380
- inputs=[
1381
- prompt_input,
1382
- text_input,
1383
- input_type,
1384
- image_size,
1385
- border_size,
1386
- error_correction,
1387
- module_size,
1388
- module_drawer
1389
- ],
1390
- outputs=[output_image, error_message],
1391
- fn=generate_standard_qr,
1392
- cache_examples=False
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1393
  )
1394
 
1395
- # ARTISTIC QR TAB
1396
- with gr.TabItem("Artistic QR"):
1397
  with gr.Row():
1398
  with gr.Column():
1399
- # Add input type selector for artistic QR
1400
- artistic_input_type = gr.Radio(
1401
  choices=["URL", "Plain Text"],
1402
  value="URL",
1403
  label="Input Type",
1404
  info="URL: For web links (auto-removes https://). Plain Text: For VCARD, WiFi, calendar, location, etc. (no manipulation)"
1405
  )
1406
 
1407
- # Add inputs for artistic QR
1408
- artistic_prompt_input = gr.Textbox(
1409
  label="Prompt",
1410
  placeholder="Describe the image you want to generate (check examples below for inspiration)",
1411
  value="Enter your prompt here... For example: 'a beautiful sunset over mountains, photorealistic, detailed landscape'",
1412
  lines=3
1413
  )
1414
- artistic_text_input = gr.Textbox(
1415
  label="QR Code Content",
1416
  placeholder="Enter URL or plain text",
1417
  value="Enter your URL or text here... For example: https://github.com",
@@ -1421,63 +1468,63 @@ if __name__ == "__main__" and not os.environ.get('QR_TESTING_MODE'):
1421
  # Import Settings section - separate accordion
1422
  with gr.Accordion("Import Settings from JSON", open=False):
1423
  gr.Markdown("Paste a settings JSON string (copied from a previous generation) to load all parameters at once.")
1424
- import_json_input_artistic = gr.Textbox(
1425
  label="Paste Settings JSON",
1426
- placeholder='{"pipeline": "artistic", "prompt": "...", "seed": 718313, ...}',
1427
  lines=3
1428
  )
1429
- import_status_artistic = gr.Textbox(
1430
  label="Import Status",
1431
  interactive=False,
1432
  visible=False,
1433
  lines=2
1434
  )
1435
  with gr.Row():
1436
- load_settings_btn_artistic = gr.Button("Load Settings", variant="primary")
1437
- clear_json_btn_artistic = gr.Button("Clear", variant="secondary")
1438
 
1439
  # Change Settings Manually - separate accordion
1440
  with gr.Accordion("Change Settings Manually", open=False):
1441
- # Add image size slider for artistic QR
1442
- artistic_image_size = gr.Slider(
1443
  minimum=512,
1444
  maximum=1024,
1445
  step=64,
1446
- value=704,
1447
  label="Image Size",
1448
- info="Base size of the generated image. Final output will be 2x this size (e.g., 7041408) due to the two-step enhancement process. Higher values use more VRAM and take longer to process."
1449
  )
1450
 
1451
- # Add border size slider for artistic QR
1452
- artistic_border_size = gr.Slider(
1453
  minimum=0,
1454
  maximum=8,
1455
  step=1,
1456
- value=6,
1457
  label="QR Code Border Size",
1458
  info="Number of modules (squares) to use as border around the QR code. Higher values add more whitespace."
1459
  )
1460
 
1461
- # Add error correction dropdown for artistic QR
1462
- artistic_error_correction = gr.Dropdown(
1463
  choices=["Low (7%)", "Medium (15%)", "Quartile (25%)", "High (30%)"],
1464
- value="High (30%)",
1465
  label="Error Correction Level",
1466
- info="Higher error correction makes the QR code more scannable when damaged or obscured, but increases its size and complexity. High (30%) is recommended for artistic QR codes."
1467
  )
1468
 
1469
- # Add module size slider for artistic QR
1470
- artistic_module_size = gr.Slider(
1471
  minimum=4,
1472
  maximum=16,
1473
  step=1,
1474
- value=16,
1475
  label="QR Module Size",
1476
- info="Pixel width of the smallest QR code unit. Larger values improve readability but require a larger image size. 16 is a good starting point."
1477
  )
1478
 
1479
- # Add module drawer dropdown with style examples for artistic QR
1480
- artistic_module_drawer = gr.Dropdown(
1481
  choices=["Square", "Gapped Square", "Circle", "Rounded", "Vertical bars", "Horizontal bars"],
1482
  value="Square",
1483
  label="QR Code Style",
@@ -1512,361 +1559,180 @@ if __name__ == "__main__" and not os.environ.get('QR_TESTING_MODE'):
1512
  gr.Image("custom_nodes/ComfyQR/img/horizontal-bars.png", width=100, show_label=False, show_download_button=False)
1513
 
1514
  # Add upscale checkbox
1515
- artistic_enable_upscale = gr.Checkbox(
1516
  label="Enable Upscaling",
1517
- value=True,
1518
- info="Enable upscaling with RealESRGAN for higher quality output (enabled by default for artistic pipeline)"
1519
  )
1520
 
1521
- # Add seed controls for artistic QR
1522
- artistic_use_custom_seed = gr.Checkbox(
 
 
 
 
 
 
 
1523
  label="Use Custom Seed",
1524
  value=True,
1525
  info="Enable to use a specific seed for reproducible results"
1526
  )
1527
- artistic_seed = gr.Slider(
1528
  minimum=0,
1529
  maximum=2000000,
1530
  step=1,
1531
  value=718313,
1532
  label="Seed",
1533
- visible=True, # Initially visible since artistic_use_custom_seed=True
1534
  info="Seed value for reproducibility. Same seed with same settings will produce the same result."
1535
  )
1536
 
1537
- # FreeU Parameters
1538
- gr.Markdown("### FreeU Quality Enhancement")
1539
- enable_freeu_artistic = gr.Checkbox(
1540
- label="Enable FreeU",
1541
- value=True,
1542
- info="Enable FreeU quality enhancement (enabled by default for artistic pipeline)"
1543
- )
1544
- freeu_b1 = gr.Slider(
1545
- minimum=1.0,
1546
- maximum=1.6,
1547
- step=0.01,
1548
- value=1.4,
1549
- label="FreeU B1 (Backbone 1)",
1550
- info="Backbone feature enhancement for first layer. Higher values improve detail but may reduce blending. Range: 1.0-1.6, Default: 1.4"
1551
- )
1552
- freeu_b2 = gr.Slider(
1553
- minimum=1.0,
1554
- maximum=1.6,
1555
- step=0.01,
1556
- value=1.3,
1557
- label="FreeU B2 (Backbone 2)",
1558
- info="Backbone feature enhancement for second layer. Higher values improve texture. Range: 1.0-1.6, Default: 1.3"
1559
- )
1560
- freeu_s1 = gr.Slider(
1561
- minimum=0.0,
1562
- maximum=1.5,
1563
- step=0.01,
1564
- value=0.0,
1565
- label="FreeU S1 (Skip 1)",
1566
- info="Skip connection dampening for first layer. Lower values hide QR structure more. Range: 0.0-1.5, Default: 0.0"
1567
- )
1568
- freeu_s2 = gr.Slider(
1569
- minimum=0.0,
1570
- maximum=1.5,
1571
- step=0.01,
1572
- value=1.3,
1573
- label="FreeU S2 (Skip 2)",
1574
- info="Skip connection dampening for second layer. Balances scannability. Range: 0.0-1.5, Default: 1.3"
1575
- )
1576
-
1577
- # SAG (Self-Attention Guidance) Parameters
1578
- gr.Markdown("### SAG (Self-Attention Guidance)")
1579
- enable_sag = gr.Checkbox(
1580
- label="Enable SAG",
1581
- value=True,
1582
- info="Enable Self-Attention Guidance for improved structural coherence and artistic blending"
1583
- )
1584
- sag_scale = gr.Slider(
1585
- minimum=0.0,
1586
- maximum=3.0,
1587
- step=0.1,
1588
- value=0.5,
1589
- label="SAG Scale",
1590
- info="Guidance strength. Higher values provide more structural coherence. Range: 0.0-3.0, Default: 0.5"
1591
- )
1592
- sag_blur_sigma = gr.Slider(
1593
- minimum=0.0,
1594
- maximum=5.0,
1595
- step=0.1,
1596
- value=0.5,
1597
- label="SAG Blur Sigma",
1598
- info="Blur amount for artistic blending. Higher values create softer, more artistic effects. Range: 0.0-5.0, Default: 0.5"
1599
- )
1600
-
1601
  # ControlNet Strength Parameters
1602
  gr.Markdown("### ControlNet Strength (QR Code Preservation)")
1603
  gr.Markdown("**IMPORTANT:** Lower values preserve QR structure better (more scannable). Higher values create more artistic effects but may reduce scannability.")
1604
- controlnet_strength_first = gr.Slider(
1605
  minimum=0.0,
1606
  maximum=1.0,
1607
  step=0.05,
1608
  value=0.45,
1609
- label="First Pass Strength",
1610
- info="Controls how much the AI modifies the QR in the first pass. LOWER = more scannable, HIGHER = more artistic. Try 0.30-0.40 for better scannability. Default: 0.45"
1611
  )
1612
- controlnet_strength_final = gr.Slider(
1613
  minimum=0.0,
1614
  maximum=1.0,
1615
  step=0.05,
1616
- value=0.7,
1617
- label="Final Pass Strength",
1618
- info="Controls how much the AI modifies the QR in the refinement pass. LOWER = preserves QR structure, HIGHER = more creative. Try 0.55-0.65 for balance. Default: 0.70"
1619
  )
1620
 
1621
- # The generate button for artistic QR
1622
- artistic_generate_btn = gr.Button("Generate Artistic QR", variant="primary")
1623
-
1624
  with gr.Column():
1625
- # The output image for artistic QR
1626
- artistic_output_image = gr.Image(label="Generated Artistic QR Code")
1627
- artistic_error_message = gr.Textbox(
1628
  label="Status / Errors",
1629
  interactive=False,
1630
  lines=3,
1631
  )
1632
  # Wrap settings output in accordion (initially hidden)
1633
- with gr.Accordion("Shareable Settings (JSON)", open=True, visible=False) as settings_accordion_artistic:
1634
- settings_output_artistic = gr.Textbox(
1635
  label="Copy this JSON to share your exact settings",
1636
  interactive=True,
1637
  lines=5,
1638
  show_copy_button=True
1639
  )
1640
 
1641
- # When clicking the button, it will trigger the artistic function
1642
- artistic_generate_btn.click(
1643
- fn=generate_artistic_qr,
1644
- inputs=[artistic_prompt_input, artistic_text_input, artistic_input_type, artistic_image_size, artistic_border_size, artistic_error_correction, artistic_module_size, artistic_module_drawer, artistic_use_custom_seed, artistic_seed, artistic_enable_upscale, enable_freeu_artistic, freeu_b1, freeu_b2, freeu_s1, freeu_s2, enable_sag, sag_scale, sag_blur_sigma, controlnet_strength_first, controlnet_strength_final],
1645
- outputs=[artistic_output_image, artistic_error_message, settings_output_artistic, settings_accordion_artistic]
1646
  )
1647
 
1648
  # Load Settings button event handler
1649
- load_settings_btn_artistic.click(
1650
- fn=load_settings_from_json_artistic,
1651
- inputs=[import_json_input_artistic],
1652
  outputs=[
1653
- artistic_prompt_input,
1654
- artistic_text_input,
1655
- artistic_input_type,
1656
- artistic_image_size,
1657
- artistic_border_size,
1658
- artistic_error_correction,
1659
- artistic_module_size,
1660
- artistic_module_drawer,
1661
- artistic_use_custom_seed,
1662
- artistic_seed,
1663
- artistic_enable_upscale,
1664
- enable_freeu_artistic,
1665
- freeu_b1,
1666
- freeu_b2,
1667
- freeu_s1,
1668
- freeu_s2,
1669
- enable_sag,
1670
- sag_scale,
1671
- sag_blur_sigma,
1672
- controlnet_strength_first,
1673
- controlnet_strength_final,
1674
- import_status_artistic
1675
  ]
1676
  )
1677
 
1678
- # Clear button event handler for artistic tab
1679
- clear_json_btn_artistic.click(
1680
  fn=lambda: ("", gr.update(visible=False)),
1681
  inputs=[],
1682
- outputs=[import_json_input_artistic, import_status_artistic]
1683
  )
1684
 
1685
- # Seed slider visibility toggle for artistic tab
1686
- artistic_use_custom_seed.change(
1687
  fn=lambda x: gr.update(visible=x),
1688
- inputs=[artistic_use_custom_seed],
1689
- outputs=[artistic_seed]
1690
- )
1691
-
1692
- # Custom Examples Gallery with Images
1693
- gr.Markdown("### Featured Examples")
1694
- gr.Markdown("Click 'Load Settings' under any example to populate the form with those exact settings")
1695
-
1696
- # First row (3 images)
1697
- with gr.Row():
1698
- # Example 1: Japanese Temple
1699
- with gr.Column(scale=1):
1700
- ex1_img = gr.Image("examples/artistic/japanese_temple.jpg", label="Japanese Temple", show_label=True, interactive=False, show_download_button=False, height=280)
1701
- ex1_btn = gr.Button("Load Settings", size="sm", variant="secondary")
1702
-
1703
- # Example 2: Sunset Mountains
1704
- with gr.Column(scale=1):
1705
- ex2_img = gr.Image("examples/artistic/sunset_mountains.jpg", label="Sunset Mountains", show_label=True, interactive=False, show_download_button=False, height=280)
1706
- ex2_btn = gr.Button("Load Settings", size="sm", variant="secondary")
1707
-
1708
- # Example 3: Roman City
1709
- with gr.Column(scale=1):
1710
- ex3_img = gr.Image("examples/artistic/roman_city.jpg", label="Roman City", show_label=True, interactive=False, show_download_button=False, height=280)
1711
- ex3_btn = gr.Button("Load Settings", size="sm", variant="secondary")
1712
-
1713
- # Second row (3 images)
1714
- with gr.Row():
1715
- # Example 4: Neapolitan Pizza
1716
- with gr.Column(scale=1):
1717
- ex4_img = gr.Image("examples/artistic/neapolitan_pizza.webp", label="Neapolitan Pizza", show_label=True, interactive=False, show_download_button=False, height=280)
1718
- ex4_btn = gr.Button("Load Settings", size="sm", variant="secondary")
1719
-
1720
- # Example 5: Poker Chips
1721
- with gr.Column(scale=1):
1722
- ex5_img = gr.Image("examples/artistic/poker_chips.webp", label="Poker Chips", show_label=True, interactive=False, show_download_button=False, height=280)
1723
- ex5_btn = gr.Button("Load Settings", size="sm", variant="secondary")
1724
-
1725
- # Example 6: Underwater Fish
1726
- with gr.Column(scale=1):
1727
- ex6_img = gr.Image("examples/artistic/underwater_fish.webp", label="Underwater Fish", show_label=True, interactive=False, show_download_button=False, height=280)
1728
- ex6_btn = gr.Button("Load Settings", size="sm", variant="secondary")
1729
-
1730
- # Third row (3 images)
1731
- with gr.Row():
1732
- # Example 7: Mediterranean Garden
1733
- with gr.Column(scale=1):
1734
- ex7_img = gr.Image("examples/artistic/mediterranean_garden.jpg", label="Mediterranean Garden", show_label=True, interactive=False, show_download_button=False, height=280)
1735
- ex7_btn = gr.Button("Load Settings", size="sm", variant="secondary")
1736
-
1737
- # Example 8: Rice Fields
1738
- with gr.Column(scale=1):
1739
- ex8_img = gr.Image("examples/artistic/rice_fields.jpg", label="Rice Fields", show_label=True, interactive=False, show_download_button=False, height=280)
1740
- ex8_btn = gr.Button("Load Settings", size="sm", variant="secondary")
1741
-
1742
- # Example 9: Cyberpunk City
1743
- with gr.Column(scale=1):
1744
- ex9_img = gr.Image("examples/artistic/cyberpunk_city.webp", label="Cyberpunk City", show_label=True, interactive=False, show_download_button=False, height=280)
1745
- ex9_btn = gr.Button("Load Settings", size="sm", variant="secondary")
1746
-
1747
- # Load settings button handlers
1748
- # Ex1: Japanese Temple
1749
- ex1_btn.click(
1750
- fn=lambda: ("some clothes spread on ropes, Japanese girl sits inside in the middle of the image, few sakura flowers, realistic, great details, out in the open air sunny day realistic, great details, absence of people, Detailed and Intricate, CGI, Photoshoot, rim light, 8k, 16k, ultra detail", "https://www.google.com", "URL", 640, 6, "Medium (15%)", 14, "Square", True, 718313, 0.5),
1751
- outputs=[artistic_prompt_input, artistic_text_input, artistic_input_type, artistic_image_size, artistic_border_size, artistic_error_correction, artistic_module_size, artistic_module_drawer, artistic_use_custom_seed, artistic_seed, sag_blur_sigma]
1752
- )
1753
- # Ex2: Sunset Mountains
1754
- ex2_btn.click(
1755
- fn=lambda: ("a beautiful sunset over mountains, photorealistic, detailed landscape, golden hour, dramatic lighting, 8k, ultra detailed", "https://github.com", "URL", 704, 6, "High (30%)", 16, "Square", True, 718313, 0.5),
1756
- outputs=[artistic_prompt_input, artistic_text_input, artistic_input_type, artistic_image_size, artistic_border_size, artistic_error_correction, artistic_module_size, artistic_module_drawer, artistic_use_custom_seed, artistic_seed, sag_blur_sigma]
1757
- )
1758
- # Ex3: Roman City
1759
- ex3_btn.click(
1760
- fn=lambda: ("aerial bird view of ancient Roman city, cobblestone streets and pathways forming intricate patterns, vintage illustration style, sepia tones, aged parchment look, detailed architecture, 8k, ultra detailed", "WIFI:T:WPA;S:MyNetwork;P:MyPassword123;;", "Plain Text", 832, 6, "High (30%)", 16, "Square", True, 718313, 0.5),
1761
- outputs=[artistic_prompt_input, artistic_text_input, artistic_input_type, artistic_image_size, artistic_border_size, artistic_error_correction, artistic_module_size, artistic_module_drawer, artistic_use_custom_seed, artistic_seed, sag_blur_sigma]
1762
- )
1763
- # Ex4: Neapolitan Pizza
1764
- ex4_btn.click(
1765
- fn=lambda: ("artisan Neapolitan pizza on rustic wooden board, fresh basil leaves scattered on top and around, oregano sprinkled, flour dust particles floating in air, melted mozzarella with char marks, traditional Italian pizzeria ambiance, warm brick oven glow in background, detailed food photography, photorealistic, 8k, ultra detailed", "https://www.pizzamaking.com", "URL", 704, 6, "High (30%)", 16, "Square", True, 856749, 2.0),
1766
- outputs=[artistic_prompt_input, artistic_text_input, artistic_input_type, artistic_image_size, artistic_border_size, artistic_error_correction, artistic_module_size, artistic_module_drawer, artistic_use_custom_seed, artistic_seed, sag_blur_sigma]
1767
- )
1768
- # Ex5: Poker Chips
1769
- ex5_btn.click(
1770
- fn=lambda: ("some cards on poker tale, realistic, great details, realistic, great details,absence of people, Detailed and Intricate, CGI, Photoshoot,rim light, 8k, 16k, ultra detail", "https://store.steampowered.com", "URL", 768, 6, "High (30%)", 16, "Square", True, 718313, 2.5),
1771
- outputs=[artistic_prompt_input, artistic_text_input, artistic_input_type, artistic_image_size, artistic_border_size, artistic_error_correction, artistic_module_size, artistic_module_drawer, artistic_use_custom_seed, artistic_seed, sag_blur_sigma]
1772
- )
1773
- # Ex6: Underwater Fish
1774
- ex6_btn.click(
1775
- fn=lambda: ("underwater scene with tropical fish, coral reef, rays of sunlight penetrating water, vibrant colors, detailed marine life, photorealistic, 8k, ultra detailed", "https://www.reddit.com", "URL", 704, 6, "High (30%)", 16, "Square", True, 718313, 0.5),
1776
- outputs=[artistic_prompt_input, artistic_text_input, artistic_input_type, artistic_image_size, artistic_border_size, artistic_error_correction, artistic_module_size, artistic_module_drawer, artistic_use_custom_seed, artistic_seed, sag_blur_sigma]
1777
- )
1778
- # Ex7: Mediterranean Garden
1779
- ex7_btn.click(
1780
- fn=lambda: ("ancient stone sundial in Mediterranean garden, olive trees, dappled sunlight through leaves, weathered stone texture, peaceful afternoon scene, photorealistic, detailed, 8k, ultra detailed", "BEGIN:VEVENT\\nSUMMARY:Team Meeting\\nDTSTART:20251115T140000Z\\nDTEND:20251115T150000Z\\nLOCATION:Conference Room A\\nEND:VEVENT", "Plain Text", 1024, 6, "High (30%)", 14, "Square", True, 413468, 0.5),
1781
- outputs=[artistic_prompt_input, artistic_text_input, artistic_input_type, artistic_image_size, artistic_border_size, artistic_error_correction, artistic_module_size, artistic_module_drawer, artistic_use_custom_seed, artistic_seed, sag_blur_sigma]
1782
- )
1783
- # Ex8: Rice Fields
1784
- ex8_btn.click(
1785
- fn=lambda: ("aerial view of terraced rice fields on mountainside, winding pathways between green paddies, Asian countryside, bird's eye perspective, detailed landscape, golden hour lighting, photorealistic, 8k, ultra detailed", "geo:37.7749,-122.4194", "Plain Text", 704, 6, "High (30%)", 16, "Square", True, 962359, 0.5),
1786
- outputs=[artistic_prompt_input, artistic_text_input, artistic_input_type, artistic_image_size, artistic_border_size, artistic_error_correction, artistic_module_size, artistic_module_drawer, artistic_use_custom_seed, artistic_seed, sag_blur_sigma]
1787
- )
1788
- # Ex9: Cyberpunk City
1789
- ex9_btn.click(
1790
- fn=lambda: ("futuristic cityscape with flying cars and neon lights, cyberpunk style, detailed architecture, night scene, 8k, ultra detailed", "https://linkedin.com", "URL", 704, 6, "High (30%)", 16, "Square", True, 718313, 1.5),
1791
- outputs=[artistic_prompt_input, artistic_text_input, artistic_input_type, artistic_image_size, artistic_border_size, artistic_error_correction, artistic_module_size, artistic_module_drawer, artistic_use_custom_seed, artistic_seed, sag_blur_sigma]
1792
  )
1793
 
1794
- gr.Markdown("---")
1795
- gr.Markdown("### All Examples (Text-based)")
1796
-
1797
- # Add examples for artistic QR
1798
- artistic_examples = [
1799
  [
1800
- "some clothes spread on ropes, Japanese girl sits inside in the middle of the image, few sakura flowers, realistic, great details, out in the open air sunny day realistic, great details, absence of people, Detailed and Intricate, CGI, Photoshoot, rim light, 8k, 16k, ultra detail",
1801
  "https://www.google.com",
1802
  "URL",
1803
- 640, # Image size
1804
- 6, # Border
1805
- "Medium (15%)", # Error correction
1806
- 14, # Module size
1807
- "Square",
1808
- True, # use_custom_seed
1809
- 718313 # seed
1810
  ],
1811
  [
1812
  "some cards on poker tale, realistic, great details, realistic, great details,absence of people, Detailed and Intricate, CGI, Photoshoot,rim light, 8k, 16k, ultra detail",
1813
  "https://store.steampowered.com",
1814
  "URL",
1815
- 768, # Image size
1816
- 6, # Border
1817
- "High (30%)", # Error correction
1818
- 16, # Module size
1819
- "Square",
1820
- True, # use_custom_seed
1821
- 718313 # seed
1822
  ],
1823
  [
1824
  "a beautiful sunset over mountains, photorealistic, detailed landscape, golden hour, dramatic lighting, 8k, ultra detailed",
1825
  "https://github.com",
1826
  "URL",
1827
- 704, # Image size (default)
1828
- 6, # Border
1829
- "High (30%)", # Error correction
1830
- 16, # Module size
1831
- "Square",
1832
- True, # use_custom_seed
1833
- 718313 # seed
1834
  ],
1835
  [
1836
  "underwater scene with coral reef and tropical fish, photorealistic, detailed, crystal clear water, sunlight rays, 8k, ultra detailed",
1837
  "https://twitter.com",
1838
  "URL",
1839
- 704, # Image size (default)
1840
- 6, # Border
1841
- "High (30%)", # Error correction
1842
- 16, # Module size
1843
- "Square",
1844
- True, # use_custom_seed
1845
- 718313 # seed
1846
  ],
1847
  [
1848
  "futuristic cityscape with flying cars and neon lights, cyberpunk style, detailed architecture, night scene, 8k, ultra detailed",
1849
  "https://linkedin.com",
1850
  "URL",
1851
- 704, # Image size (default)
1852
- 6, # Border
1853
- "High (30%)", # Error correction
1854
- 16, # Module size
1855
- "Square",
1856
- True, # use_custom_seed
1857
- 718313 # seed
1858
  ],
1859
  [
1860
  "vintage camera on wooden table, photorealistic, detailed textures, soft lighting, bokeh background, 8k, ultra detailed",
1861
  "https://instagram.com",
1862
  "URL",
1863
- 704, # Image size (default)
1864
- 6, # Border
1865
- "High (30%)", # Error correction
1866
- 16, # Module size
1867
- "Square",
1868
- True, # use_custom_seed
1869
- 718313 # seed
1870
  ],
1871
  [
1872
  "business card design, professional, modern, clean layout, corporate style, detailed, 8k, ultra detailed",
@@ -1879,60 +1745,53 @@ if __name__ == "__main__" and not os.environ.get('QR_TESTING_MODE'):
1879
  "Square"
1880
  ],
1881
  [
1882
- "aerial bird view of ancient Roman city, cobblestone streets and pathways forming intricate patterns, vintage illustration style, sepia tones, aged parchment look, detailed architecture, 8k, ultra detailed",
1883
  "WIFI:T:WPA;S:MyNetwork;P:MyPassword123;;",
1884
  "Plain Text",
1885
- 832, # Image size
1886
- 6, # Border
1887
- "High (30%)", # Error correction
1888
- 16, # Module size
1889
- "Square",
1890
- True, # use_custom_seed
1891
- 718313 # seed
1892
  ],
1893
  [
1894
- "ancient stone sundial in Mediterranean garden, olive trees, dappled sunlight through leaves, weathered stone texture, peaceful afternoon scene, photorealistic, detailed, 8k, ultra detailed",
1895
  "BEGIN:VEVENT\nSUMMARY:Team Meeting\nDTSTART:20251115T140000Z\nDTEND:20251115T150000Z\nLOCATION:Conference Room A\nEND:VEVENT",
1896
  "Plain Text",
1897
- 1024, # Image size
1898
- 6, # Border
1899
- "High (30%)", # Error correction
1900
- 14, # Module size
1901
- "Square",
1902
- True, # use_custom_seed
1903
- 413468 # seed (custom for meeting)
1904
  ],
1905
  [
1906
- "aerial view of terraced rice fields on mountainside, winding pathways between green paddies, Asian countryside, bird's eye perspective, detailed landscape, golden hour lighting, photorealistic, 8k, ultra detailed",
1907
  "geo:37.7749,-122.4194",
1908
  "Plain Text",
1909
- 704, # Image size (default)
1910
- 6, # Border
1911
- "High (30%)", # Error correction
1912
- 16, # Module size
1913
- "Square",
1914
- True, # use_custom_seed
1915
- 962359 # seed (custom for location)
1916
  ]
1917
  ]
1918
 
1919
  gr.Examples(
1920
- examples=artistic_examples,
1921
  inputs=[
1922
- artistic_prompt_input,
1923
- artistic_text_input,
1924
- artistic_input_type,
1925
- artistic_image_size,
1926
- artistic_border_size,
1927
- artistic_error_correction,
1928
- artistic_module_size,
1929
- artistic_module_drawer,
1930
- artistic_use_custom_seed,
1931
- artistic_seed
1932
  ],
1933
- outputs=[artistic_output_image, artistic_error_message],
1934
- fn=generate_artistic_qr,
1935
  cache_examples=False
1936
  )
1937
 
 
1938
  app.launch(share=False, mcp_server=True)
 
1029
  - **Copy/paste settings**: After generation, copy the JSON settings string that appears below the image and paste it into "Import Settings from JSON" to reproduce exact results or share with others
1030
 
1031
  ### Two Modes:
1032
+ - **Artistic QR** (New pipeline, default): More artistic and creative results with upscaling (slower, more creative, less scannable)
1033
+ - **Standard QR** (Old pipeline, more stable): Stable, accurate QR code generation (faster, more scannable, less creative)
1034
 
1035
  ### Note:
1036
+ Selecting image_size more then 704 might fail to generate image when other users are trying app at the same time.
1037
+
1038
  Feel free to share your suggestions or feedback on how to improve the app! Thanks!
1039
  """)
1040
 
1041
  # Add tabs for different generation methods
1042
  with gr.Tabs():
1043
+ # ARTISTIC QR TAB
1044
+ with gr.TabItem("Artistic QR"):
1045
  with gr.Row():
1046
  with gr.Column():
1047
+ # Add input type selector for artistic QR
1048
+ artistic_input_type = gr.Radio(
1049
  choices=["URL", "Plain Text"],
1050
  value="URL",
1051
  label="Input Type",
1052
  info="URL: For web links (auto-removes https://). Plain Text: For VCARD, WiFi, calendar, location, etc. (no manipulation)"
1053
  )
1054
 
1055
+ # Add inputs for artistic QR
1056
+ artistic_prompt_input = gr.Textbox(
1057
  label="Prompt",
1058
  placeholder="Describe the image you want to generate (check examples below for inspiration)",
1059
  value="Enter your prompt here... For example: 'a beautiful sunset over mountains, photorealistic, detailed landscape'",
1060
  lines=3
1061
  )
1062
+ artistic_text_input = gr.Textbox(
1063
  label="QR Code Content",
1064
  placeholder="Enter URL or plain text",
1065
  value="Enter your URL or text here... For example: https://github.com",
 
1069
  # Import Settings section - separate accordion
1070
  with gr.Accordion("Import Settings from JSON", open=False):
1071
  gr.Markdown("Paste a settings JSON string (copied from a previous generation) to load all parameters at once.")
1072
+ import_json_input_artistic = gr.Textbox(
1073
  label="Paste Settings JSON",
1074
+ placeholder='{"pipeline": "artistic", "prompt": "...", "seed": 718313, ...}',
1075
  lines=3
1076
  )
1077
+ import_status_artistic = gr.Textbox(
1078
  label="Import Status",
1079
  interactive=False,
1080
  visible=False,
1081
  lines=2
1082
  )
1083
  with gr.Row():
1084
+ load_settings_btn_artistic = gr.Button("Load Settings", variant="primary")
1085
+ clear_json_btn_artistic = gr.Button("Clear", variant="secondary")
1086
 
1087
  # Change Settings Manually - separate accordion
1088
  with gr.Accordion("Change Settings Manually", open=False):
1089
+ # Add image size slider for artistic QR
1090
+ artistic_image_size = gr.Slider(
1091
  minimum=512,
1092
  maximum=1024,
1093
  step=64,
1094
+ value=704,
1095
  label="Image Size",
1096
+ info="Base size of the generated image. Final output will be 2x this size (e.g., 7041408) due to the two-step enhancement process. Higher values use more VRAM and take longer to process."
1097
  )
1098
 
1099
+ # Add border size slider for artistic QR
1100
+ artistic_border_size = gr.Slider(
1101
  minimum=0,
1102
  maximum=8,
1103
  step=1,
1104
+ value=6,
1105
  label="QR Code Border Size",
1106
  info="Number of modules (squares) to use as border around the QR code. Higher values add more whitespace."
1107
  )
1108
 
1109
+ # Add error correction dropdown for artistic QR
1110
+ artistic_error_correction = gr.Dropdown(
1111
  choices=["Low (7%)", "Medium (15%)", "Quartile (25%)", "High (30%)"],
1112
+ value="High (30%)",
1113
  label="Error Correction Level",
1114
+ info="Higher error correction makes the QR code more scannable when damaged or obscured, but increases its size and complexity. High (30%) is recommended for artistic QR codes."
1115
  )
1116
 
1117
+ # Add module size slider for artistic QR
1118
+ artistic_module_size = gr.Slider(
1119
  minimum=4,
1120
  maximum=16,
1121
  step=1,
1122
+ value=16,
1123
  label="QR Module Size",
1124
+ info="Pixel width of the smallest QR code unit. Larger values improve readability but require a larger image size. 16 is a good starting point."
1125
  )
1126
 
1127
+ # Add module drawer dropdown with style examples for artistic QR
1128
+ artistic_module_drawer = gr.Dropdown(
1129
  choices=["Square", "Gapped Square", "Circle", "Rounded", "Vertical bars", "Horizontal bars"],
1130
  value="Square",
1131
  label="QR Code Style",
 
1160
  gr.Image("custom_nodes/ComfyQR/img/horizontal-bars.png", width=100, show_label=False, show_download_button=False)
1161
 
1162
  # Add upscale checkbox
1163
+ artistic_enable_upscale = gr.Checkbox(
1164
  label="Enable Upscaling",
1165
+ value=True,
1166
+ info="Enable upscaling with RealESRGAN for higher quality output (enabled by default for artistic pipeline)"
 
 
 
 
 
 
 
1167
  )
1168
 
1169
+ # Add seed controls for artistic QR
1170
+ artistic_use_custom_seed = gr.Checkbox(
1171
  label="Use Custom Seed",
1172
  value=True,
1173
  info="Enable to use a specific seed for reproducible results"
1174
  )
1175
+ artistic_seed = gr.Slider(
1176
  minimum=0,
1177
  maximum=2000000,
1178
  step=1,
1179
  value=718313,
1180
  label="Seed",
1181
+ visible=True, # Initially visible since artistic_use_custom_seed=True
1182
  info="Seed value for reproducibility. Same seed with same settings will produce the same result."
1183
  )
1184
 
1185
+ # FreeU Parameters
1186
+ gr.Markdown("### FreeU Quality Enhancement")
1187
+ enable_freeu_artistic = gr.Checkbox(
1188
+ label="Enable FreeU",
1189
+ value=True,
1190
+ info="Enable FreeU quality enhancement (enabled by default for artistic pipeline)"
1191
+ )
1192
+ freeu_b1 = gr.Slider(
1193
+ minimum=1.0,
1194
+ maximum=1.6,
1195
+ step=0.01,
1196
+ value=1.4,
1197
+ label="FreeU B1 (Backbone 1)",
1198
+ info="Backbone feature enhancement for first layer. Higher values improve detail but may reduce blending. Range: 1.0-1.6, Default: 1.4"
1199
+ )
1200
+ freeu_b2 = gr.Slider(
1201
+ minimum=1.0,
1202
+ maximum=1.6,
1203
+ step=0.01,
1204
+ value=1.3,
1205
+ label="FreeU B2 (Backbone 2)",
1206
+ info="Backbone feature enhancement for second layer. Higher values improve texture. Range: 1.0-1.6, Default: 1.3"
1207
+ )
1208
+ freeu_s1 = gr.Slider(
1209
+ minimum=0.0,
1210
+ maximum=1.5,
1211
+ step=0.01,
1212
+ value=0.0,
1213
+ label="FreeU S1 (Skip 1)",
1214
+ info="Skip connection dampening for first layer. Lower values hide QR structure more. Range: 0.0-1.5, Default: 0.0"
1215
+ )
1216
+ freeu_s2 = gr.Slider(
1217
+ minimum=0.0,
1218
+ maximum=1.5,
1219
+ step=0.01,
1220
+ value=1.3,
1221
+ label="FreeU S2 (Skip 2)",
1222
+ info="Skip connection dampening for second layer. Balances scannability. Range: 0.0-1.5, Default: 1.3"
1223
+ )
1224
+
1225
+ # SAG (Self-Attention Guidance) Parameters
1226
+ gr.Markdown("### SAG (Self-Attention Guidance)")
1227
+ enable_sag = gr.Checkbox(
1228
+ label="Enable SAG",
1229
+ value=True,
1230
+ info="Enable Self-Attention Guidance for improved structural coherence and artistic blending"
1231
+ )
1232
+ sag_scale = gr.Slider(
1233
+ minimum=0.0,
1234
+ maximum=3.0,
1235
+ step=0.1,
1236
+ value=0.5,
1237
+ label="SAG Scale",
1238
+ info="Guidance strength. Higher values provide more structural coherence. Range: 0.0-3.0, Default: 0.5"
1239
+ )
1240
+ sag_blur_sigma = gr.Slider(
1241
+ minimum=0.0,
1242
+ maximum=5.0,
1243
+ step=0.1,
1244
+ value=0.5,
1245
+ label="SAG Blur Sigma",
1246
+ info="Blur amount for artistic blending. Higher values create softer, more artistic effects. Range: 0.0-5.0, Default: 0.5"
1247
+ )
1248
+
1249
  # ControlNet Strength Parameters
1250
  gr.Markdown("### ControlNet Strength (QR Code Preservation)")
1251
  gr.Markdown("**IMPORTANT:** Lower values preserve QR structure better (more scannable). Higher values create more artistic effects but may reduce scannability.")
1252
+ controlnet_strength_first = gr.Slider(
1253
  minimum=0.0,
1254
  maximum=1.0,
1255
  step=0.05,
1256
  value=0.45,
1257
+ label="First Pass Strength",
1258
+ info="Controls how much the AI modifies the QR in the first pass. LOWER = more scannable, HIGHER = more artistic. Try 0.30-0.40 for better scannability. Default: 0.45"
1259
  )
1260
+ controlnet_strength_final = gr.Slider(
1261
  minimum=0.0,
1262
  maximum=1.0,
1263
  step=0.05,
1264
+ value=0.7,
1265
+ label="Final Pass Strength",
1266
+ info="Controls how much the AI modifies the QR in the refinement pass. LOWER = preserves QR structure, HIGHER = more creative. Try 0.55-0.65 for balance. Default: 0.70"
1267
  )
1268
 
1269
+ # The generate button for artistic QR
1270
+ artistic_generate_btn = gr.Button("Generate Artistic QR", variant="primary")
1271
 
1272
  with gr.Column():
1273
+ # The output image for artistic QR
1274
+ artistic_output_image = gr.Image(label="Generated Artistic QR Code")
1275
+ artistic_error_message = gr.Textbox(
1276
  label="Status / Errors",
1277
  interactive=False,
1278
  lines=3,
1279
  )
1280
  # Wrap settings output in accordion (initially hidden)
1281
+ with gr.Accordion("Shareable Settings (JSON)", open=True, visible=False) as settings_accordion_artistic:
1282
+ settings_output_artistic = gr.Textbox(
1283
  label="Copy this JSON to share your exact settings",
1284
  interactive=True,
1285
  lines=5,
1286
  show_copy_button=True
1287
  )
1288
 
1289
+ # When clicking the button, it will trigger the artistic function
1290
+ artistic_generate_btn.click(
1291
+ fn=generate_artistic_qr,
1292
+ inputs=[artistic_prompt_input, artistic_text_input, artistic_input_type, artistic_image_size, artistic_border_size, artistic_error_correction, artistic_module_size, artistic_module_drawer, artistic_use_custom_seed, artistic_seed, artistic_enable_upscale, enable_freeu_artistic, freeu_b1, freeu_b2, freeu_s1, freeu_s2, enable_sag, sag_scale, sag_blur_sigma, controlnet_strength_first, controlnet_strength_final],
1293
+ outputs=[artistic_output_image, artistic_error_message, settings_output_artistic, settings_accordion_artistic]
1294
  )
1295
 
1296
  # Load Settings button event handler
1297
+ load_settings_btn_artistic.click(
1298
+ fn=load_settings_from_json_artistic,
1299
+ inputs=[import_json_input_artistic],
1300
  outputs=[
1301
+ artistic_prompt_input,
1302
+ artistic_text_input,
1303
+ artistic_input_type,
1304
+ artistic_image_size,
1305
+ artistic_border_size,
1306
+ artistic_error_correction,
1307
+ artistic_module_size,
1308
+ artistic_module_drawer,
1309
+ artistic_use_custom_seed,
1310
+ artistic_seed,
1311
+ artistic_enable_upscale,
1312
+ enable_freeu_artistic,
1313
+ freeu_b1,
1314
+ freeu_b2,
1315
+ freeu_s1,
1316
+ freeu_s2,
1317
+ enable_sag,
1318
+ sag_scale,
1319
+ sag_blur_sigma,
1320
+ controlnet_strength_first,
1321
+ controlnet_strength_final,
1322
+ import_status_artistic
1323
  ]
1324
  )
1325
 
1326
+ # Clear button event handler for artistic tab
1327
+ clear_json_btn_artistic.click(
1328
  fn=lambda: ("", gr.update(visible=False)),
1329
  inputs=[],
1330
+ outputs=[import_json_input_artistic, import_status_artistic]
1331
  )
1332
 
1333
+ # Seed slider visibility toggle for artistic tab
1334
+ artistic_use_custom_seed.change(
1335
  fn=lambda x: gr.update(visible=x),
1336
+ inputs=[artistic_use_custom_seed],
1337
+ outputs=[artistic_seed]
1338
  )
1339
 
1340
+ # Custom Examples Gallery with Images
1341
+ gr.Markdown("### Featured Examples")
1342
+ gr.Markdown("Click 'Load Settings' under any example to populate the form with those exact settings")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1343
 
1344
+ # First row (3 images)
1345
+ with gr.Row():
1346
+ # Example 1: Japanese Temple
1347
+ with gr.Column(scale=1):
1348
+ ex1_img = gr.Image("examples/artistic/japanese_temple.jpg", label="Japanese Temple", show_label=True, interactive=False, show_download_button=False, height=280)
1349
+ ex1_btn = gr.Button("Load Settings", size="sm", variant="secondary")
1350
+
1351
+ # Example 2: Sunset Mountains
1352
+ with gr.Column(scale=1):
1353
+ ex2_img = gr.Image("examples/artistic/sunset_mountains.jpg", label="Sunset Mountains", show_label=True, interactive=False, show_download_button=False, height=280)
1354
+ ex2_btn = gr.Button("Load Settings", size="sm", variant="secondary")
1355
+
1356
+ # Example 3: Roman City
1357
+ with gr.Column(scale=1):
1358
+ ex3_img = gr.Image("examples/artistic/roman_city.jpg", label="Roman City", show_label=True, interactive=False, show_download_button=False, height=280)
1359
+ ex3_btn = gr.Button("Load Settings", size="sm", variant="secondary")
1360
+
1361
+ # Second row (3 images)
1362
+ with gr.Row():
1363
+ # Example 4: Neapolitan Pizza
1364
+ with gr.Column(scale=1):
1365
+ ex4_img = gr.Image("examples/artistic/neapolitan_pizza.webp", label="Neapolitan Pizza", show_label=True, interactive=False, show_download_button=False, height=280)
1366
+ ex4_btn = gr.Button("Load Settings", size="sm", variant="secondary")
1367
+
1368
+ # Example 5: Poker Chips
1369
+ with gr.Column(scale=1):
1370
+ ex5_img = gr.Image("examples/artistic/poker_chips.webp", label="Poker Chips", show_label=True, interactive=False, show_download_button=False, height=280)
1371
+ ex5_btn = gr.Button("Load Settings", size="sm", variant="secondary")
1372
+
1373
+ # Example 6: Underwater Fish
1374
+ with gr.Column(scale=1):
1375
+ ex6_img = gr.Image("examples/artistic/underwater_fish.webp", label="Underwater Fish", show_label=True, interactive=False, show_download_button=False, height=280)
1376
+ ex6_btn = gr.Button("Load Settings", size="sm", variant="secondary")
1377
+
1378
+ # Third row (3 images)
1379
+ with gr.Row():
1380
+ # Example 7: Mediterranean Garden
1381
+ with gr.Column(scale=1):
1382
+ ex7_img = gr.Image("examples/artistic/mediterranean_garden.jpg", label="Mediterranean Garden", show_label=True, interactive=False, show_download_button=False, height=280)
1383
+ ex7_btn = gr.Button("Load Settings", size="sm", variant="secondary")
1384
+
1385
+ # Example 8: Rice Fields
1386
+ with gr.Column(scale=1):
1387
+ ex8_img = gr.Image("examples/artistic/rice_fields.jpg", label="Rice Fields", show_label=True, interactive=False, show_download_button=False, height=280)
1388
+ ex8_btn = gr.Button("Load Settings", size="sm", variant="secondary")
1389
+
1390
+ # Example 9: Cyberpunk City
1391
+ with gr.Column(scale=1):
1392
+ ex9_img = gr.Image("examples/artistic/cyberpunk_city.webp", label="Cyberpunk City", show_label=True, interactive=False, show_download_button=False, height=280)
1393
+ ex9_btn = gr.Button("Load Settings", size="sm", variant="secondary")
1394
+
1395
+ # Load settings button handlers
1396
+ # Ex1: Japanese Temple
1397
+ ex1_btn.click(
1398
+ fn=lambda: ("some clothes spread on ropes, Japanese girl sits inside in the middle of the image, few sakura flowers, realistic, great details, out in the open air sunny day realistic, great details, absence of people, Detailed and Intricate, CGI, Photoshoot, rim light, 8k, 16k, ultra detail", "https://www.google.com", "URL", 640, 6, "Medium (15%)", 14, "Square", True, 718313, 0.5),
1399
+ outputs=[artistic_prompt_input, artistic_text_input, artistic_input_type, artistic_image_size, artistic_border_size, artistic_error_correction, artistic_module_size, artistic_module_drawer, artistic_use_custom_seed, artistic_seed, sag_blur_sigma]
1400
+ )
1401
+ # Ex2: Sunset Mountains
1402
+ ex2_btn.click(
1403
+ fn=lambda: ("a beautiful sunset over mountains, photorealistic, detailed landscape, golden hour, dramatic lighting, 8k, ultra detailed", "https://github.com", "URL", 704, 6, "High (30%)", 16, "Square", True, 718313, 0.5),
1404
+ outputs=[artistic_prompt_input, artistic_text_input, artistic_input_type, artistic_image_size, artistic_border_size, artistic_error_correction, artistic_module_size, artistic_module_drawer, artistic_use_custom_seed, artistic_seed, sag_blur_sigma]
1405
+ )
1406
+ # Ex3: Roman City
1407
+ ex3_btn.click(
1408
+ fn=lambda: ("aerial bird view of ancient Roman city, cobblestone streets and pathways forming intricate patterns, vintage illustration style, sepia tones, aged parchment look, detailed architecture, 8k, ultra detailed", "WIFI:T:WPA;S:MyNetwork;P:MyPassword123;;", "Plain Text", 832, 6, "High (30%)", 16, "Square", True, 718313, 0.5),
1409
+ outputs=[artistic_prompt_input, artistic_text_input, artistic_input_type, artistic_image_size, artistic_border_size, artistic_error_correction, artistic_module_size, artistic_module_drawer, artistic_use_custom_seed, artistic_seed, sag_blur_sigma]
1410
+ )
1411
+ # Ex4: Neapolitan Pizza
1412
+ ex4_btn.click(
1413
+ fn=lambda: ("artisan Neapolitan pizza on rustic wooden board, fresh basil leaves scattered on top and around, oregano sprinkled, flour dust particles floating in air, melted mozzarella with char marks, traditional Italian pizzeria ambiance, warm brick oven glow in background, detailed food photography, photorealistic, 8k, ultra detailed", "https://www.pizzamaking.com", "URL", 704, 6, "High (30%)", 16, "Square", True, 856749, 2.0),
1414
+ outputs=[artistic_prompt_input, artistic_text_input, artistic_input_type, artistic_image_size, artistic_border_size, artistic_error_correction, artistic_module_size, artistic_module_drawer, artistic_use_custom_seed, artistic_seed, sag_blur_sigma]
1415
+ )
1416
+ # Ex5: Poker Chips
1417
+ ex5_btn.click(
1418
+ fn=lambda: ("some cards on poker tale, realistic, great details, realistic, great details,absence of people, Detailed and Intricate, CGI, Photoshoot,rim light, 8k, 16k, ultra detail", "https://store.steampowered.com", "URL", 768, 6, "High (30%)", 16, "Square", True, 718313, 2.5),
1419
+ outputs=[artistic_prompt_input, artistic_text_input, artistic_input_type, artistic_image_size, artistic_border_size, artistic_error_correction, artistic_module_size, artistic_module_drawer, artistic_use_custom_seed, artistic_seed, sag_blur_sigma]
1420
+ )
1421
+ # Ex6: Underwater Fish
1422
+ ex6_btn.click(
1423
+ fn=lambda: ("underwater scene with tropical fish, coral reef, rays of sunlight penetrating water, vibrant colors, detailed marine life, photorealistic, 8k, ultra detailed", "https://www.reddit.com", "URL", 704, 6, "High (30%)", 16, "Square", True, 718313, 0.5),
1424
+ outputs=[artistic_prompt_input, artistic_text_input, artistic_input_type, artistic_image_size, artistic_border_size, artistic_error_correction, artistic_module_size, artistic_module_drawer, artistic_use_custom_seed, artistic_seed, sag_blur_sigma]
1425
+ )
1426
+ # Ex7: Mediterranean Garden
1427
+ ex7_btn.click(
1428
+ fn=lambda: ("ancient stone sundial in Mediterranean garden, olive trees, dappled sunlight through leaves, weathered stone texture, peaceful afternoon scene, photorealistic, detailed, 8k, ultra detailed", "BEGIN:VEVENT\\nSUMMARY:Team Meeting\\nDTSTART:20251115T140000Z\\nDTEND:20251115T150000Z\\nLOCATION:Conference Room A\\nEND:VEVENT", "Plain Text", 1024, 6, "High (30%)", 14, "Square", True, 413468, 0.5),
1429
+ outputs=[artistic_prompt_input, artistic_text_input, artistic_input_type, artistic_image_size, artistic_border_size, artistic_error_correction, artistic_module_size, artistic_module_drawer, artistic_use_custom_seed, artistic_seed, sag_blur_sigma]
1430
+ )
1431
+ # Ex8: Rice Fields
1432
+ ex8_btn.click(
1433
+ fn=lambda: ("aerial view of terraced rice fields on mountainside, winding pathways between green paddies, Asian countryside, bird's eye perspective, detailed landscape, golden hour lighting, photorealistic, 8k, ultra detailed", "geo:37.7749,-122.4194", "Plain Text", 704, 6, "High (30%)", 16, "Square", True, 962359, 0.5),
1434
+ outputs=[artistic_prompt_input, artistic_text_input, artistic_input_type, artistic_image_size, artistic_border_size, artistic_error_correction, artistic_module_size, artistic_module_drawer, artistic_use_custom_seed, artistic_seed, sag_blur_sigma]
1435
+ )
1436
+ # Ex9: Cyberpunk City
1437
+ ex9_btn.click(
1438
+ fn=lambda: ("futuristic cityscape with flying cars and neon lights, cyberpunk style, detailed architecture, night scene, 8k, ultra detailed", "https://linkedin.com", "URL", 704, 6, "High (30%)", 16, "Square", True, 718313, 1.5),
1439
+ outputs=[artistic_prompt_input, artistic_text_input, artistic_input_type, artistic_image_size, artistic_border_size, artistic_error_correction, artistic_module_size, artistic_module_drawer, artistic_use_custom_seed, artistic_seed, sag_blur_sigma]
1440
  )
1441
 
1442
+ # STANDARD QR TAB
1443
+ with gr.TabItem("Standard QR"):
1444
  with gr.Row():
1445
  with gr.Column():
1446
+ # Add input type selector
1447
+ input_type = gr.Radio(
1448
  choices=["URL", "Plain Text"],
1449
  value="URL",
1450
  label="Input Type",
1451
  info="URL: For web links (auto-removes https://). Plain Text: For VCARD, WiFi, calendar, location, etc. (no manipulation)"
1452
  )
1453
 
1454
+ # Add inputs
1455
+ prompt_input = gr.Textbox(
1456
  label="Prompt",
1457
  placeholder="Describe the image you want to generate (check examples below for inspiration)",
1458
  value="Enter your prompt here... For example: 'a beautiful sunset over mountains, photorealistic, detailed landscape'",
1459
  lines=3
1460
  )
1461
+ text_input = gr.Textbox(
1462
  label="QR Code Content",
1463
  placeholder="Enter URL or plain text",
1464
  value="Enter your URL or text here... For example: https://github.com",
 
1468
  # Import Settings section - separate accordion
1469
  with gr.Accordion("Import Settings from JSON", open=False):
1470
  gr.Markdown("Paste a settings JSON string (copied from a previous generation) to load all parameters at once.")
1471
+ import_json_input_standard = gr.Textbox(
1472
  label="Paste Settings JSON",
1473
+ placeholder='{"pipeline": "standard", "prompt": "...", "seed": 718313, ...}',
1474
  lines=3
1475
  )
1476
+ import_status_standard = gr.Textbox(
1477
  label="Import Status",
1478
  interactive=False,
1479
  visible=False,
1480
  lines=2
1481
  )
1482
  with gr.Row():
1483
+ load_settings_btn_standard = gr.Button("Load Settings", variant="primary")
1484
+ clear_json_btn_standard = gr.Button("Clear", variant="secondary")
1485
 
1486
  # Change Settings Manually - separate accordion
1487
  with gr.Accordion("Change Settings Manually", open=False):
1488
+ # Add image size slider
1489
+ image_size = gr.Slider(
1490
  minimum=512,
1491
  maximum=1024,
1492
  step=64,
1493
+ value=512,
1494
  label="Image Size",
1495
+ info="Base size of the generated image. Final output will be 2x this size (e.g., 5121024) due to the two-step enhancement process. Higher values use more VRAM and take longer to process."
1496
  )
1497
 
1498
+ # Add border size slider
1499
+ border_size = gr.Slider(
1500
  minimum=0,
1501
  maximum=8,
1502
  step=1,
1503
+ value=4,
1504
  label="QR Code Border Size",
1505
  info="Number of modules (squares) to use as border around the QR code. Higher values add more whitespace."
1506
  )
1507
 
1508
+ # Add error correction dropdown
1509
+ error_correction = gr.Dropdown(
1510
  choices=["Low (7%)", "Medium (15%)", "Quartile (25%)", "High (30%)"],
1511
+ value="Medium (15%)",
1512
  label="Error Correction Level",
1513
+ info="Higher error correction makes the QR code more scannable when damaged or obscured, but increases its size and complexity. Medium (15%) is a good starting point for most uses."
1514
  )
1515
 
1516
+ # Add module size slider
1517
+ module_size = gr.Slider(
1518
  minimum=4,
1519
  maximum=16,
1520
  step=1,
1521
+ value=12,
1522
  label="QR Module Size",
1523
+ info="Pixel width of the smallest QR code unit. Larger values improve readability but require a larger image size. 12 is a good starting point."
1524
  )
1525
 
1526
+ # Add module drawer dropdown with style examples
1527
+ module_drawer = gr.Dropdown(
1528
  choices=["Square", "Gapped Square", "Circle", "Rounded", "Vertical bars", "Horizontal bars"],
1529
  value="Square",
1530
  label="QR Code Style",
 
1559
  gr.Image("custom_nodes/ComfyQR/img/horizontal-bars.png", width=100, show_label=False, show_download_button=False)
1560
 
1561
  # Add upscale checkbox
1562
+ enable_upscale = gr.Checkbox(
1563
  label="Enable Upscaling",
1564
+ value=False,
1565
+ info="Enable upscaling with RealESRGAN for higher quality output (disabled by default for standard pipeline)"
1566
  )
1567
 
1568
+ # Add FreeU checkbox
1569
+ enable_freeu_standard = gr.Checkbox(
1570
+ label="Enable FreeU",
1571
+ value=False,
1572
+ info="Enable FreeU quality enhancement (disabled by default for standard pipeline)"
1573
+ )
1574
+
1575
+ # Add seed controls
1576
+ use_custom_seed = gr.Checkbox(
1577
  label="Use Custom Seed",
1578
  value=True,
1579
  info="Enable to use a specific seed for reproducible results"
1580
  )
1581
+ seed = gr.Slider(
1582
  minimum=0,
1583
  maximum=2000000,
1584
  step=1,
1585
  value=718313,
1586
  label="Seed",
1587
+ visible=True, # Initially visible since use_custom_seed=True
1588
  info="Seed value for reproducibility. Same seed with same settings will produce the same result."
1589
  )
1590
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1591
  # ControlNet Strength Parameters
1592
  gr.Markdown("### ControlNet Strength (QR Code Preservation)")
1593
  gr.Markdown("**IMPORTANT:** Lower values preserve QR structure better (more scannable). Higher values create more artistic effects but may reduce scannability.")
1594
+ controlnet_strength_standard_first = gr.Slider(
1595
  minimum=0.0,
1596
  maximum=1.0,
1597
  step=0.05,
1598
  value=0.45,
1599
+ label="First Pass Strength (Brightness + Tile)",
1600
+ info="Controls how much the AI modifies the QR in both ControlNet passes. LOWER = more scannable, HIGHER = more artistic. Try 0.35-0.50 for good balance. Default: 0.45"
1601
  )
1602
+ controlnet_strength_standard_final = gr.Slider(
1603
  minimum=0.0,
1604
  maximum=1.0,
1605
  step=0.05,
1606
+ value=1.0,
1607
+ label="Final Pass Strength (Tile Refinement)",
1608
+ info="Controls the final tile ControlNet pass strength. Usually kept at 1.0 for clarity. Default: 1.0"
1609
  )
1610
 
1611
+ # The generate button
1612
+ generate_btn = gr.Button("Generate Standard QR", variant="primary")
1613
+
1614
  with gr.Column():
1615
+ # The output image
1616
+ output_image = gr.Image(label="Generated Standard QR Code")
1617
+ error_message = gr.Textbox(
1618
  label="Status / Errors",
1619
  interactive=False,
1620
  lines=3,
1621
  )
1622
  # Wrap settings output in accordion (initially hidden)
1623
+ with gr.Accordion("Shareable Settings (JSON)", open=True, visible=False) as settings_accordion_standard:
1624
+ settings_output_standard = gr.Textbox(
1625
  label="Copy this JSON to share your exact settings",
1626
  interactive=True,
1627
  lines=5,
1628
  show_copy_button=True
1629
  )
1630
 
1631
+ # When clicking the button, it will trigger the main function
1632
+ generate_btn.click(
1633
+ fn=generate_standard_qr,
1634
+ inputs=[prompt_input, text_input, input_type, image_size, border_size, error_correction, module_size, module_drawer, use_custom_seed, seed, enable_upscale, enable_freeu_standard, controlnet_strength_standard_first, controlnet_strength_standard_final],
1635
+ outputs=[output_image, error_message, settings_output_standard, settings_accordion_standard]
1636
  )
1637
 
1638
  # Load Settings button event handler
1639
+ load_settings_btn_standard.click(
1640
+ fn=load_settings_from_json_standard,
1641
+ inputs=[import_json_input_standard],
1642
  outputs=[
1643
+ prompt_input,
1644
+ text_input,
1645
+ input_type,
1646
+ image_size,
1647
+ border_size,
1648
+ error_correction,
1649
+ module_size,
1650
+ module_drawer,
1651
+ use_custom_seed,
1652
+ seed,
1653
+ enable_upscale,
1654
+ enable_freeu_standard,
1655
+ controlnet_strength_standard_first,
1656
+ controlnet_strength_standard_final,
1657
+ import_status_standard
 
 
 
 
 
 
 
1658
  ]
1659
  )
1660
 
1661
+ # Clear button event handler
1662
+ clear_json_btn_standard.click(
1663
  fn=lambda: ("", gr.update(visible=False)),
1664
  inputs=[],
1665
+ outputs=[import_json_input_standard, import_status_standard]
1666
  )
1667
 
1668
+ # Seed slider visibility toggle
1669
+ use_custom_seed.change(
1670
  fn=lambda x: gr.update(visible=x),
1671
+ inputs=[use_custom_seed],
1672
+ outputs=[seed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1673
  )
1674
 
1675
+ # Add examples
1676
+ examples = [
 
 
 
1677
  [
1678
+ "some clothes spread on ropes, realistic, great details, out in the open air sunny day realistic, great details,absence of people, Detailed and Intricate, CGI, Photoshoot,rim light, 8k, 16k, ultra detail",
1679
  "https://www.google.com",
1680
  "URL",
1681
+ 512,
1682
+ 4,
1683
+ "Medium (15%)",
1684
+ 12,
1685
+ "Square"
 
 
1686
  ],
1687
  [
1688
  "some cards on poker tale, realistic, great details, realistic, great details,absence of people, Detailed and Intricate, CGI, Photoshoot,rim light, 8k, 16k, ultra detail",
1689
  "https://store.steampowered.com",
1690
  "URL",
1691
+ 512,
1692
+ 4,
1693
+ "Medium (15%)",
1694
+ 12,
1695
+ "Square"
 
 
1696
  ],
1697
  [
1698
  "a beautiful sunset over mountains, photorealistic, detailed landscape, golden hour, dramatic lighting, 8k, ultra detailed",
1699
  "https://github.com",
1700
  "URL",
1701
+ 512,
1702
+ 4,
1703
+ "Medium (15%)",
1704
+ 12,
1705
+ "Square"
 
 
1706
  ],
1707
  [
1708
  "underwater scene with coral reef and tropical fish, photorealistic, detailed, crystal clear water, sunlight rays, 8k, ultra detailed",
1709
  "https://twitter.com",
1710
  "URL",
1711
+ 512,
1712
+ 4,
1713
+ "Medium (15%)",
1714
+ 12,
1715
+ "Square"
 
 
1716
  ],
1717
  [
1718
  "futuristic cityscape with flying cars and neon lights, cyberpunk style, detailed architecture, night scene, 8k, ultra detailed",
1719
  "https://linkedin.com",
1720
  "URL",
1721
+ 512,
1722
+ 4,
1723
+ "Medium (15%)",
1724
+ 12,
1725
+ "Square"
 
 
1726
  ],
1727
  [
1728
  "vintage camera on wooden table, photorealistic, detailed textures, soft lighting, bokeh background, 8k, ultra detailed",
1729
  "https://instagram.com",
1730
  "URL",
1731
+ 512,
1732
+ 4,
1733
+ "Medium (15%)",
1734
+ 12,
1735
+ "Square"
 
 
1736
  ],
1737
  [
1738
  "business card design, professional, modern, clean layout, corporate style, detailed, 8k, ultra detailed",
 
1745
  "Square"
1746
  ],
1747
  [
1748
+ "wifi network symbol, modern tech, digital art, glowing blue, detailed, 8k, ultra detailed",
1749
  "WIFI:T:WPA;S:MyNetwork;P:MyPassword123;;",
1750
  "Plain Text",
1751
+ 576,
1752
+ 4,
1753
+ "Medium (15%)",
1754
+ 12,
1755
+ "Square"
 
 
1756
  ],
1757
  [
1758
+ "calendar appointment reminder, organized planner, professional office, detailed, 8k, ultra detailed",
1759
  "BEGIN:VEVENT\nSUMMARY:Team Meeting\nDTSTART:20251115T140000Z\nDTEND:20251115T150000Z\nLOCATION:Conference Room A\nEND:VEVENT",
1760
  "Plain Text",
1761
+ 832,
1762
+ 4,
1763
+ "Medium (15%)",
1764
+ 12,
1765
+ "Square"
 
 
1766
  ],
1767
  [
1768
+ "location pin on map, travel destination, scenic view, detailed cartography, 8k, ultra detailed",
1769
  "geo:37.7749,-122.4194",
1770
  "Plain Text",
1771
+ 512,
1772
+ 4,
1773
+ "Medium (15%)",
1774
+ 12,
1775
+ "Square"
 
 
1776
  ]
1777
  ]
1778
 
1779
  gr.Examples(
1780
+ examples=examples,
1781
  inputs=[
1782
+ prompt_input,
1783
+ text_input,
1784
+ input_type,
1785
+ image_size,
1786
+ border_size,
1787
+ error_correction,
1788
+ module_size,
1789
+ module_drawer
 
 
1790
  ],
1791
+ outputs=[output_image, error_message],
1792
+ fn=generate_standard_qr,
1793
  cache_examples=False
1794
  )
1795
 
1796
+ # ARTISTIC QR TAB
1797
  app.launch(share=False, mcp_server=True)