Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -164,9 +164,9 @@ def enhance_image(
|
|
| 164 |
dtype = torch.bfloat16 if device == "cuda" else torch.float32
|
| 165 |
|
| 166 |
print(f"📥 Loading FLUX Img2Img on {device}...")
|
| 167 |
-
tokenizer_2 = T5TokenizerFast.from_pretrained("black-forest-labs/FLUX.1-
|
| 168 |
pipe = FluxImg2ImgPipeline.from_pretrained(
|
| 169 |
-
"black-forest-labs/FLUX.1-
|
| 170 |
torch_dtype=dtype,
|
| 171 |
low_cpu_mem_usage=True,
|
| 172 |
device_map="balanced",
|
|
@@ -197,9 +197,9 @@ def enhance_image(
|
|
| 197 |
device = "cpu"
|
| 198 |
dtype = torch.float32
|
| 199 |
# Reload on CPU if needed
|
| 200 |
-
tokenizer_2 = T5TokenizerFast.from_pretrained("black-forest-labs/FLUX.1-
|
| 201 |
pipe = FluxImg2ImgPipeline.from_pretrained(
|
| 202 |
-
"black-forest-labs/FLUX.1-
|
| 203 |
torch_dtype=dtype,
|
| 204 |
low_cpu_mem_usage=True,
|
| 205 |
device_map=None,
|
|
@@ -319,11 +319,11 @@ with gr.Blocks(css=css, title="🎨 AI Image Upscaler - FLUX") as demo:
|
|
| 319 |
|
| 320 |
num_inference_steps = gr.Slider(
|
| 321 |
label="Number of Inference Steps",
|
| 322 |
-
minimum=
|
| 323 |
maximum=50,
|
| 324 |
step=1,
|
| 325 |
-
value=
|
| 326 |
-
info="More steps = better quality but slower"
|
| 327 |
)
|
| 328 |
|
| 329 |
denoising_strength = gr.Slider(
|
|
@@ -394,7 +394,7 @@ with gr.Blocks(css=css, title="🎨 AI Image Upscaler - FLUX") as demo:
|
|
| 394 |
|
| 395 |
gr.HTML("""
|
| 396 |
<div style="margin-top: 2rem; padding: 1rem; background: #f0f0f0; border-radius: 8px;">
|
| 397 |
-
<p><strong>Note:</strong> This upscaler uses the Flux
|
| 398 |
</div>
|
| 399 |
""")
|
| 400 |
|
|
|
|
| 164 |
dtype = torch.bfloat16 if device == "cuda" else torch.float32
|
| 165 |
|
| 166 |
print(f"📥 Loading FLUX Img2Img on {device}...")
|
| 167 |
+
tokenizer_2 = T5TokenizerFast.from_pretrained("black-forest-labs/FLUX.1-schnell", subfolder="tokenizer_2", token=huggingface_token)
|
| 168 |
pipe = FluxImg2ImgPipeline.from_pretrained(
|
| 169 |
+
"black-forest-labs/FLUX.1-schnell",
|
| 170 |
torch_dtype=dtype,
|
| 171 |
low_cpu_mem_usage=True,
|
| 172 |
device_map="balanced",
|
|
|
|
| 197 |
device = "cpu"
|
| 198 |
dtype = torch.float32
|
| 199 |
# Reload on CPU if needed
|
| 200 |
+
tokenizer_2 = T5TokenizerFast.from_pretrained("black-forest-labs/FLUX.1-schnell", subfolder="tokenizer_2", token=huggingface_token)
|
| 201 |
pipe = FluxImg2ImgPipeline.from_pretrained(
|
| 202 |
+
"black-forest-labs/FLUX.1-schnell",
|
| 203 |
torch_dtype=dtype,
|
| 204 |
low_cpu_mem_usage=True,
|
| 205 |
device_map=None,
|
|
|
|
| 319 |
|
| 320 |
num_inference_steps = gr.Slider(
|
| 321 |
label="Number of Inference Steps",
|
| 322 |
+
minimum=1,
|
| 323 |
maximum=50,
|
| 324 |
step=1,
|
| 325 |
+
value=4,
|
| 326 |
+
info="More steps = better quality but slower (default 4 for schnell)"
|
| 327 |
)
|
| 328 |
|
| 329 |
denoising_strength = gr.Slider(
|
|
|
|
| 394 |
|
| 395 |
gr.HTML("""
|
| 396 |
<div style="margin-top: 2rem; padding: 1rem; background: #f0f0f0; border-radius: 8px;">
|
| 397 |
+
<p><strong>Note:</strong> This upscaler uses the Flux.1-schnell model. Users are responsible for obtaining commercial rights if used commercially under their license.</p>
|
| 398 |
</div>
|
| 399 |
""")
|
| 400 |
|