Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -281,7 +281,10 @@ def enhance_image(
|
|
| 281 |
gr.Info(f"📏 Resizing output to target size: {w_original * upscale_factor}x{h_original * upscale_factor}")
|
| 282 |
image = image.resize((w_original * upscale_factor, h_original * upscale_factor), resample=Image.LANCZOS)
|
| 283 |
|
| 284 |
-
|
|
|
|
|
|
|
|
|
|
| 285 |
|
| 286 |
|
| 287 |
# Create Gradio interface
|
|
@@ -383,7 +386,8 @@ with gr.Blocks(css=css, title="🎨 AI Image Upscaler - Florence-2 + FLUX") as d
|
|
| 383 |
type="pil",
|
| 384 |
interactive=True,
|
| 385 |
height=600, # Made larger
|
| 386 |
-
elem_id="result_slider"
|
|
|
|
| 387 |
)
|
| 388 |
|
| 389 |
# Event handler
|
|
@@ -424,6 +428,37 @@ with gr.Blocks(css=css, title="🎨 AI Image Upscaler - Florence-2 + FLUX") as d
|
|
| 424 |
#result_slider .gr-button-tool {
|
| 425 |
display: none !important;
|
| 426 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 427 |
</style>
|
| 428 |
""")
|
| 429 |
|
|
|
|
| 281 |
gr.Info(f"📏 Resizing output to target size: {w_original * upscale_factor}x{h_original * upscale_factor}")
|
| 282 |
image = image.resize((w_original * upscale_factor, h_original * upscale_factor), resample=Image.LANCZOS)
|
| 283 |
|
| 284 |
+
# Resize input image to match output size for slider alignment
|
| 285 |
+
resized_input = true_input_image.resize(image.size, resample=Image.LANCZOS)
|
| 286 |
+
|
| 287 |
+
return [resized_input, image]
|
| 288 |
|
| 289 |
|
| 290 |
# Create Gradio interface
|
|
|
|
| 386 |
type="pil",
|
| 387 |
interactive=True,
|
| 388 |
height=600, # Made larger
|
| 389 |
+
elem_id="result_slider",
|
| 390 |
+
label=None # Remove default label
|
| 391 |
)
|
| 392 |
|
| 393 |
# Event handler
|
|
|
|
| 428 |
#result_slider .gr-button-tool {
|
| 429 |
display: none !important;
|
| 430 |
}
|
| 431 |
+
#result_slider .gr-button-undo {
|
| 432 |
+
display: none !important;
|
| 433 |
+
}
|
| 434 |
+
#result_slider .gr-button-clear {
|
| 435 |
+
display: none !important;
|
| 436 |
+
}
|
| 437 |
+
#result_slider .badge-container .badge {
|
| 438 |
+
display: none !important;
|
| 439 |
+
}
|
| 440 |
+
#result_slider .badge-container::before {
|
| 441 |
+
content: "Before";
|
| 442 |
+
position: absolute;
|
| 443 |
+
top: 10px;
|
| 444 |
+
left: 10px;
|
| 445 |
+
background: rgba(0,0,0,0.5);
|
| 446 |
+
color: white;
|
| 447 |
+
padding: 5px;
|
| 448 |
+
border-radius: 5px;
|
| 449 |
+
z-index: 10;
|
| 450 |
+
}
|
| 451 |
+
#result_slider .badge-container::after {
|
| 452 |
+
content: "After";
|
| 453 |
+
position: absolute;
|
| 454 |
+
top: 10px;
|
| 455 |
+
right: 10px;
|
| 456 |
+
background: rgba(0,0,0,0.5);
|
| 457 |
+
color: white;
|
| 458 |
+
padding: 5px;
|
| 459 |
+
border-radius: 5px;
|
| 460 |
+
z-index: 10;
|
| 461 |
+
}
|
| 462 |
</style>
|
| 463 |
""")
|
| 464 |
|