patrickvonplaten commited on
Commit
6f4d4ac
1 Parent(s): e067f97

add examples

Browse files
Files changed (1) hide show
  1. app.py +113 -87
app.py CHANGED
@@ -151,14 +151,14 @@ There are two modes to generate beautiful QR codes:
151
  1. **Blend-in mode**. Use the QR code image as the initial image **and** the control image.
152
  When using the QR code as both the init and control image, you can get QR Codes that blend in **very** naturally with your provided prompt.
153
  The strength parameter defines how much noise is added to your QR code and the noisy QR code is then guided towards both your prompt and the QR code image via Controlnet.
154
- Make sure to leave the radio *Use QR code as init image* checked and use a high strength value (between 0.8 and 0.95) and choose a lower conditioning scale (between 0.7 and 1.3).
155
  This mode arguably achieves the asthetically most appealing images, but also requires more tuning of the controlnet conditioning scale and the strength value. If the generated image
156
  looks way to much like the original QR code, make sure to gently increase the *strength* value and reduce the *conditioning* scale. Also check out the examples below.
157
 
158
  2. **Condition-only mode**. Use the QR code image **only** as the control image and denoise from a provided initial image.
159
  When providing an initial image or letting SD 2.1 generate the initial image, you have much more freedom to decide how the generated QR code can look like depending on your provided image.
160
  This mode allows you to stongly steer the generated QR code into a style, landscape, motive that you provided before-hand. This mode tends to generate QR codes that
161
- are less *"blend-in"* with the QR code itself. Make sure to choose high controlnet conditioning scales between 2.0 and 3.0 and lower strength values between 0.5 and 0.7. Also check examples below.
162
 
163
  model: https://huggingface.co/DionTimmer/controlnet_qrcode-control_v1p_sd15
164
 
@@ -253,91 +253,117 @@ model: https://huggingface.co/DionTimmer/controlnet_qrcode-control_v1p_sd15
253
  outputs=[result_image],
254
  )
255
 
256
- # gr.Examples(
257
- # examples=[
258
- # [
259
- # "https://huggingface.co/",
260
- # "A sky view of a colorful lakes and rivers flowing through the desert",
261
- # "ugly, disfigured, low quality, blurry, nsfw",
262
- # 7.5,
263
- # 1.3,
264
- # 0.9,
265
- # 5392011833,
266
- # None,
267
- # None,
268
- # True,
269
- # "DPM++ Karras SDE",
270
- # ],
271
- # [
272
- # "https://huggingface.co/spaces/huggingface-projects/QR-code-AI-art-generator",
273
- # "billboard amidst the bustling skyline of New York City, with iconic landmarks subtly featured in the background.",
274
- # "ugly, disfigured, low quality, blurry, nsfw",
275
- # 13.37,
276
- # 2.81,
277
- # 0.68,
278
- # 2313123,
279
- # "./examples/hack.png",
280
- # "./examples/hack.png",
281
- # False,
282
- # "DDIM",
283
- # ],
284
- # [
285
- # "https://huggingface.co/spaces/huggingface-projects/QR-code-AI-art-generator",
286
- # "beautiful sunset in San Francisco with Golden Gate bridge in the background",
287
- # "ugly, disfigured, low quality, blurry, nsfw",
288
- # 11.01,
289
- # 2.61,
290
- # 0.66,
291
- # 1423585430,
292
- # "./examples/hack.png",
293
- # "./examples/hack.png",
294
- # False,
295
- # "DDIM",
296
- # ],
297
- # [
298
- # "https://huggingface.co",
299
- # "A flying cat over a jungle",
300
- # "ugly, disfigured, low quality, blurry, nsfw",
301
- # 13,
302
- # 2.81,
303
- # 0.66,
304
- # 2702246671,
305
- # "./examples/hack.png",
306
- # "./examples/hack.png",
307
- # False,
308
- # "DDIM",
309
- # ],
310
- # [
311
- # "",
312
- # "crisp QR code prominently displayed on a billboard amidst the bustling skyline of New York City, with iconic landmarks subtly featured in the background.",
313
- # "ugly, disfigured, low quality, blurry, nsfw",
314
- # 10.0,
315
- # 2.0,
316
- # 0.8,
317
- # 2313123,
318
- # "./examples/init.jpeg",
319
- # "./examples/qrcode.png",
320
- # False,
321
- # "DDIM",
322
- # ],
323
- # ],
324
- # fn=inference,
325
- # inputs=[
326
- # qr_code_content,
327
- # prompt,
328
- # negative_prompt,
329
- # guidance_scale,
330
- # controlnet_conditioning_scale,
331
- # strength,
332
- # seed,
333
- # init_image,
334
- # qr_code_image,
335
- # use_qr_code_as_init_image,
336
- # sampler,
337
- # ],
338
- # outputs=[result_image],
339
- # cache_examples=True,
340
- # )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
341
 
342
  blocks.queue(concurrency_count=1, max_size=20)
343
  blocks.launch(share=True)
 
151
  1. **Blend-in mode**. Use the QR code image as the initial image **and** the control image.
152
  When using the QR code as both the init and control image, you can get QR Codes that blend in **very** naturally with your provided prompt.
153
  The strength parameter defines how much noise is added to your QR code and the noisy QR code is then guided towards both your prompt and the QR code image via Controlnet.
154
+ Make sure to leave the radio *Use QR code as init image* checked and use a high strength value (between 0.8 and 0.95) and choose a lower conditioning scale (between 0.6 and 2.0).
155
  This mode arguably achieves the asthetically most appealing images, but also requires more tuning of the controlnet conditioning scale and the strength value. If the generated image
156
  looks way to much like the original QR code, make sure to gently increase the *strength* value and reduce the *conditioning* scale. Also check out the examples below.
157
 
158
  2. **Condition-only mode**. Use the QR code image **only** as the control image and denoise from a provided initial image.
159
  When providing an initial image or letting SD 2.1 generate the initial image, you have much more freedom to decide how the generated QR code can look like depending on your provided image.
160
  This mode allows you to stongly steer the generated QR code into a style, landscape, motive that you provided before-hand. This mode tends to generate QR codes that
161
+ are less *"blend-in"* with the QR code itself. Make sure to choose high controlnet conditioning scales between 1.5 and 5.0 and lower strength values between 0.5 and 0.7. Also check examples below.
162
 
163
  model: https://huggingface.co/DionTimmer/controlnet_qrcode-control_v1p_sd15
164
 
 
253
  outputs=[result_image],
254
  )
255
 
256
+ gr.Examples(
257
+ examples=[
258
+ [
259
+ "https://huggingface.co/",
260
+ "A sky view of a colorful lakes and rivers flowing through the desert",
261
+ "ugly, disfigured, low quality, blurry, nsfw",
262
+ 7.5,
263
+ 1.3,
264
+ 0.9,
265
+ 5392011833,
266
+ None,
267
+ None,
268
+ True,
269
+ "DPM++ Karras SDE",
270
+ ],
271
+ [
272
+ "https://huggingface.co/",
273
+ "Bright sunshine coming through the cracks of a wet, cave wall of big rocks",
274
+ "ugly, disfigured, low quality, blurry, nsfw",
275
+ 7.5,
276
+ 1.11,
277
+ 0.9,
278
+ 2523992465,
279
+ None,
280
+ None,
281
+ True,
282
+ "DPM++ Karras SDE",
283
+ ],
284
+ [
285
+ "https://huggingface.co/",
286
+ "Sky view of highly aesthetic, ancient greek thermal baths in beautiful nature",
287
+ "ugly, disfigured, low quality, blurry, nsfw",
288
+ 7.5,
289
+ 1.5,
290
+ 0.9,
291
+ 2523992465,
292
+ None,
293
+ None,
294
+ True,
295
+ "DPM++ Karras SDE",
296
+ ],
297
+ [
298
+ "https://huggingface.co/spaces/huggingface-projects/QR-code-AI-art-generator",
299
+ "billboard amidst the bustling skyline of New York City, with iconic landmarks subtly featured in the background.",
300
+ "ugly, disfigured, low quality, blurry, nsfw",
301
+ 13.37,
302
+ 2.81,
303
+ 0.68,
304
+ 2313123,
305
+ "./examples/hack.png",
306
+ "./examples/hack.png",
307
+ False,
308
+ "DDIM",
309
+ ],
310
+ [
311
+ "https://huggingface.co/spaces/huggingface-projects/QR-code-AI-art-generator",
312
+ "beautiful sunset in San Francisco with Golden Gate bridge in the background",
313
+ "ugly, disfigured, low quality, blurry, nsfw",
314
+ 11.01,
315
+ 2.61,
316
+ 0.66,
317
+ 1423585430,
318
+ "./examples/hack.png",
319
+ "./examples/hack.png",
320
+ False,
321
+ "DDIM",
322
+ ],
323
+ [
324
+ "https://huggingface.co",
325
+ "A flying cat over a jungle",
326
+ "ugly, disfigured, low quality, blurry, nsfw",
327
+ 13,
328
+ 2.81,
329
+ 0.66,
330
+ 2702246671,
331
+ "./examples/hack.png",
332
+ "./examples/hack.png",
333
+ False,
334
+ "DDIM",
335
+ ],
336
+ [
337
+ "",
338
+ "crisp QR code prominently displayed on a billboard amidst the bustling skyline of New York City, with iconic landmarks subtly featured in the background.",
339
+ "ugly, disfigured, low quality, blurry, nsfw",
340
+ 10.0,
341
+ 2.0,
342
+ 0.8,
343
+ 2313123,
344
+ "./examples/init.jpeg",
345
+ "./examples/qrcode.png",
346
+ False,
347
+ "DDIM",
348
+ ],
349
+ ],
350
+ fn=inference,
351
+ inputs=[
352
+ qr_code_content,
353
+ prompt,
354
+ negative_prompt,
355
+ guidance_scale,
356
+ controlnet_conditioning_scale,
357
+ strength,
358
+ seed,
359
+ init_image,
360
+ qr_code_image,
361
+ use_qr_code_as_init_image,
362
+ sampler,
363
+ ],
364
+ outputs=[result_image],
365
+ cache_examples=True,
366
+ )
367
 
368
  blocks.queue(concurrency_count=1, max_size=20)
369
  blocks.launch(share=True)