Spaces:
Running
on
Zero
Running
on
Zero
add FreeU
Browse files
app.py
CHANGED
|
@@ -10,6 +10,8 @@ import numpy as np
|
|
| 10 |
|
| 11 |
import spaces
|
| 12 |
|
|
|
|
|
|
|
| 13 |
|
| 14 |
from huggingface_hub import hf_hub_download
|
| 15 |
|
|
@@ -515,6 +517,18 @@ def _pipeline_artistic(prompt: str, qr_text: str, input_type: str, image_size: i
|
|
| 515 |
vae=get_value_at_index(checkpointloadersimple_artistic, 2),
|
| 516 |
)
|
| 517 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 518 |
# First sampling pass
|
| 519 |
samples = ksampler.sample(
|
| 520 |
seed=seed,
|
|
@@ -523,7 +537,7 @@ def _pipeline_artistic(prompt: str, qr_text: str, input_type: str, image_size: i
|
|
| 523 |
sampler_name="dpmpp_3m_sde",
|
| 524 |
scheduler="karras",
|
| 525 |
denoise=1,
|
| 526 |
-
model=
|
| 527 |
positive=get_value_at_index(controlnet_apply, 0),
|
| 528 |
negative=get_value_at_index(controlnet_apply, 1),
|
| 529 |
latent_image=get_value_at_index(latent_image, 0),
|
|
@@ -593,7 +607,7 @@ def _pipeline_artistic(prompt: str, qr_text: str, input_type: str, image_size: i
|
|
| 593 |
sampler_name="dpmpp_3m_sde",
|
| 594 |
scheduler="karras",
|
| 595 |
denoise=0.8,
|
| 596 |
-
model=
|
| 597 |
positive=get_value_at_index(controlnet_apply_final, 0),
|
| 598 |
negative=get_value_at_index(controlnet_apply_final, 1),
|
| 599 |
latent_image=get_value_at_index(upscaled_latent, 0),
|
|
|
|
| 10 |
|
| 11 |
import spaces
|
| 12 |
|
| 13 |
+
# Import FreeU for quality improvements
|
| 14 |
+
from comfy_extras.nodes_freelunch import FreeU_V2
|
| 15 |
|
| 16 |
from huggingface_hub import hf_hub_download
|
| 17 |
|
|
|
|
| 517 |
vae=get_value_at_index(checkpointloadersimple_artistic, 2),
|
| 518 |
)
|
| 519 |
|
| 520 |
+
# Apply FreeU_V2 for enhanced quality (better detail, texture, and cleaner output)
|
| 521 |
+
base_model = get_value_at_index(checkpointloadersimple_artistic, 0)
|
| 522 |
+
|
| 523 |
+
freeu = FreeU_V2()
|
| 524 |
+
enhanced_model = freeu.patch(
|
| 525 |
+
model=base_model,
|
| 526 |
+
b1=1.3, # Backbone feature enhancement - improves fine details
|
| 527 |
+
b2=1.4, # Backbone feature enhancement (layer 2) - improves textures
|
| 528 |
+
s1=0.9, # Skip connection dampening - reduces artifacts
|
| 529 |
+
s2=0.2 # Skip connection dampening (layer 2) - cleaner output
|
| 530 |
+
)[0]
|
| 531 |
+
|
| 532 |
# First sampling pass
|
| 533 |
samples = ksampler.sample(
|
| 534 |
seed=seed,
|
|
|
|
| 537 |
sampler_name="dpmpp_3m_sde",
|
| 538 |
scheduler="karras",
|
| 539 |
denoise=1,
|
| 540 |
+
model=enhanced_model, # Using FreeU + SAG enhanced model
|
| 541 |
positive=get_value_at_index(controlnet_apply, 0),
|
| 542 |
negative=get_value_at_index(controlnet_apply, 1),
|
| 543 |
latent_image=get_value_at_index(latent_image, 0),
|
|
|
|
| 607 |
sampler_name="dpmpp_3m_sde",
|
| 608 |
scheduler="karras",
|
| 609 |
denoise=0.8,
|
| 610 |
+
model=enhanced_model, # Using FreeU + SAG enhanced model
|
| 611 |
positive=get_value_at_index(controlnet_apply_final, 0),
|
| 612 |
negative=get_value_at_index(controlnet_apply_final, 1),
|
| 613 |
latent_image=get_value_at_index(upscaled_latent, 0),
|