Spaces:
Running
on
Zero
Running
on
Zero
Changed starting params.
Browse files- app.py +3 -3
- diffqrcoder_wrapper.py +4 -4
app.py
CHANGED
|
@@ -19,7 +19,7 @@ def warmup():
|
|
| 19 |
torch.backends.cuda.matmul.allow_tf32 = True
|
| 20 |
torch.backends.cudnn.allow_tf32 = True
|
| 21 |
torch.set_float32_matmul_precision("high")
|
| 22 |
-
|
| 23 |
print("π₯ Warmup starting: downloading models & building pipeline on CPU...")
|
| 24 |
pipe = load_pipeline()
|
| 25 |
print("π₯ Warmup done. Pipeline ready on CPU.")
|
|
@@ -121,7 +121,7 @@ Generate aesthetic, scanning-robust QR codes using the **DiffQRCoder** pipeline
|
|
| 121 |
control_scale = gr.Slider(
|
| 122 |
minimum=0.5,
|
| 123 |
maximum=2.0,
|
| 124 |
-
value=1
|
| 125 |
step=0.05,
|
| 126 |
label="ControlNet conditioning scale",
|
| 127 |
)
|
|
@@ -142,7 +142,7 @@ Generate aesthetic, scanning-robust QR codes using the **DiffQRCoder** pipeline
|
|
| 142 |
srmpgd_iters = gr.Slider(
|
| 143 |
minimum=0,
|
| 144 |
maximum=64,
|
| 145 |
-
value=
|
| 146 |
step=1,
|
| 147 |
label="SR-MPGD iterations (0 = disabled)",
|
| 148 |
)
|
|
|
|
| 19 |
torch.backends.cuda.matmul.allow_tf32 = True
|
| 20 |
torch.backends.cudnn.allow_tf32 = True
|
| 21 |
torch.set_float32_matmul_precision("high")
|
| 22 |
+
|
| 23 |
print("π₯ Warmup starting: downloading models & building pipeline on CPU...")
|
| 24 |
pipe = load_pipeline()
|
| 25 |
print("π₯ Warmup done. Pipeline ready on CPU.")
|
|
|
|
| 121 |
control_scale = gr.Slider(
|
| 122 |
minimum=0.5,
|
| 123 |
maximum=2.0,
|
| 124 |
+
value=1,
|
| 125 |
step=0.05,
|
| 126 |
label="ControlNet conditioning scale",
|
| 127 |
)
|
|
|
|
| 142 |
srmpgd_iters = gr.Slider(
|
| 143 |
minimum=0,
|
| 144 |
maximum=64,
|
| 145 |
+
value=6,
|
| 146 |
step=1,
|
| 147 |
label="SR-MPGD iterations (0 = disabled)",
|
| 148 |
)
|
diffqrcoder_wrapper.py
CHANGED
|
@@ -94,16 +94,16 @@ def generate_qr_art(
|
|
| 94 |
pipe: DiffQRCoderPipeline,
|
| 95 |
url_or_text: str,
|
| 96 |
prompt: str,
|
| 97 |
-
neg_prompt: str = "
|
| 98 |
-
num_inference_steps: int =
|
| 99 |
-
qrcode_module_size: int =
|
| 100 |
qrcode_padding: int = 78,
|
| 101 |
controlnet_conditioning_scale: float = 1.35,
|
| 102 |
scanning_robust_guidance_scale: float = 300.0, # softer default
|
| 103 |
perceptual_guidance_scale: float = 2.0,
|
| 104 |
srmpgd_num_iteration: int | None = 0, # 0 = disable SR-MPGD by default
|
| 105 |
srmpgd_lr: float = 0.1,
|
| 106 |
-
seed: int =
|
| 107 |
) -> Image.Image:
|
| 108 |
assert pipe is not None, "Pipeline must be loaded before calling generate_qr_art"
|
| 109 |
|
|
|
|
| 94 |
pipe: DiffQRCoderPipeline,
|
| 95 |
url_or_text: str,
|
| 96 |
prompt: str,
|
| 97 |
+
neg_prompt: str = "harsh edges, high contrast QR blockiness, noise, muddy colors, ugly, disfigured, low quality, blurry, nsfw",
|
| 98 |
+
num_inference_steps: int = 14, # gentler default
|
| 99 |
+
qrcode_module_size: int = 40,
|
| 100 |
qrcode_padding: int = 78,
|
| 101 |
controlnet_conditioning_scale: float = 1.35,
|
| 102 |
scanning_robust_guidance_scale: float = 300.0, # softer default
|
| 103 |
perceptual_guidance_scale: float = 2.0,
|
| 104 |
srmpgd_num_iteration: int | None = 0, # 0 = disable SR-MPGD by default
|
| 105 |
srmpgd_lr: float = 0.1,
|
| 106 |
+
seed: int = 42,
|
| 107 |
) -> Image.Image:
|
| 108 |
assert pipe is not None, "Pipeline must be loaded before calling generate_qr_art"
|
| 109 |
|