Upload app.py
Browse files
app.py
CHANGED
|
@@ -386,15 +386,15 @@ def outpaint_image(image, direction, extend_percent, custom_prompt, progress=gr.
|
|
| 386 |
|
| 387 |
with gr.Blocks(
|
| 388 |
title="CanvasAI",
|
| 389 |
-
theme= gr.themes.
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
gr.Markdown("""# CanvasAI
|
| 397 |
-
|
| 398 |
gr.Markdown(
|
| 399 |
"**Enhance** with Real-ESRGAN | "
|
| 400 |
"**Colorize** B&W photos with DDColor | "
|
|
@@ -405,7 +405,7 @@ with gr.Blocks(
|
|
| 405 |
with gr.Tabs():
|
| 406 |
#---------Enhance----------------
|
| 407 |
with gr.Tab(" ✨ Enhance"):
|
| 408 |
-
gr.Markdown("##
|
| 409 |
with gr.Row(equal_height= True):
|
| 410 |
with gr.Column(scale= 1):
|
| 411 |
enh_input = gr.Image(label="Upload Image", type="pil", height= 350)
|
|
@@ -417,14 +417,14 @@ with gr.Blocks(
|
|
| 417 |
)
|
| 418 |
enh_btn = gr.Button("Enhance", variant="primary", size="lg")
|
| 419 |
with gr.Column(scale=1):
|
| 420 |
-
enh_output = gr.Image(label="Result", type="pil", interactive=False, height=350,
|
| 421 |
enh_info = gr.Textbox(label="Size Info", interactive=False, container=True,)
|
| 422 |
|
| 423 |
enh_btn.click(fn=enhance_image, inputs=[enh_input, enh_scale], outputs=[enh_output, enh_info])
|
| 424 |
#--------Colourize---------------------------
|
| 425 |
with gr.Tab("Colorize"):
|
| 426 |
gr.Markdown("""
|
| 427 |
-
##
|
| 428 |
DDColor adds natural, realistic colors while preserving the original structure."""
|
| 429 |
)
|
| 430 |
with gr.Row(equal_height= True):
|
|
@@ -433,18 +433,16 @@ with gr.Blocks(
|
|
| 433 |
col_strength = gr.Slider(
|
| 434 |
minimum=0.5, maximum=1.0, value=0.9, step=0.05,
|
| 435 |
label="Color Strength",
|
| 436 |
-
# BUG 10 FIX: maximum changed from 0.7 to 1.0
|
| 437 |
info="0.5 = subtle tint · 1.0 = full vivid color"
|
| 438 |
)
|
| 439 |
col_btn = gr.Button("Colorize", variant="primary", size="lg")
|
| 440 |
with gr.Column():
|
| 441 |
-
col_output = gr.Image(label="Colorized Result", type="pil", interactive=False, height=350,
|
| 442 |
-
show_download_button=True,)
|
| 443 |
|
| 444 |
col_btn.click(fn=colour_image, inputs=[col_input, col_strength], outputs=[col_output])
|
| 445 |
#----------Outpaint-----------------------------
|
| 446 |
with gr.Tab("Outpaint"):
|
| 447 |
-
gr.Markdown("""##
|
| 448 |
Upload an image and extend it in any direction.
|
| 449 |
BLIP reads the scene automatically — no prompt needed."""
|
| 450 |
)
|
|
@@ -468,7 +466,7 @@ with gr.Blocks(
|
|
| 468 |
)
|
| 469 |
out_btn = gr.Button("Outpaint", variant="primary", size="lg")
|
| 470 |
with gr.Column(scale=1):
|
| 471 |
-
out_output = gr.Image(label="Result", type="pil", interactive=False, height= 350,
|
| 472 |
out_caption = gr.Textbox(label="Prompt Used", interactive=False, lines=4)
|
| 473 |
|
| 474 |
out_btn.click(
|
|
|
|
| 386 |
|
| 387 |
with gr.Blocks(
|
| 388 |
title="CanvasAI",
|
| 389 |
+
theme= gr.themes.Soft(
|
| 390 |
+
primary_hue=gr.themes.colors.violet,
|
| 391 |
+
secondary_hue=gr.themes.colors.purple,
|
| 392 |
+
neutral_hue=gr.themes.colors.slate,
|
| 393 |
+
radius_size=gr.themes.sizes.radius_sm,
|
| 394 |
+
)) as demo:
|
| 395 |
+
|
| 396 |
+
gr.Markdown(""" # CanvasAI
|
| 397 |
+
* AI-powered image enhancement, colorization, and outpainting *""")
|
| 398 |
gr.Markdown(
|
| 399 |
"**Enhance** with Real-ESRGAN | "
|
| 400 |
"**Colorize** B&W photos with DDColor | "
|
|
|
|
| 405 |
with gr.Tabs():
|
| 406 |
#---------Enhance----------------
|
| 407 |
with gr.Tab(" ✨ Enhance"):
|
| 408 |
+
gr.Markdown("## Upscale and sharpen any image 2x or 4x using Real-ESRGAN.")
|
| 409 |
with gr.Row(equal_height= True):
|
| 410 |
with gr.Column(scale= 1):
|
| 411 |
enh_input = gr.Image(label="Upload Image", type="pil", height= 350)
|
|
|
|
| 417 |
)
|
| 418 |
enh_btn = gr.Button("Enhance", variant="primary", size="lg")
|
| 419 |
with gr.Column(scale=1):
|
| 420 |
+
enh_output = gr.Image(label="Result", type="pil", interactive=False, height=350,)
|
| 421 |
enh_info = gr.Textbox(label="Size Info", interactive=False, container=True,)
|
| 422 |
|
| 423 |
enh_btn.click(fn=enhance_image, inputs=[enh_input, enh_scale], outputs=[enh_output, enh_info])
|
| 424 |
#--------Colourize---------------------------
|
| 425 |
with gr.Tab("Colorize"):
|
| 426 |
gr.Markdown("""
|
| 427 |
+
## B&W Photo Colorization
|
| 428 |
DDColor adds natural, realistic colors while preserving the original structure."""
|
| 429 |
)
|
| 430 |
with gr.Row(equal_height= True):
|
|
|
|
| 433 |
col_strength = gr.Slider(
|
| 434 |
minimum=0.5, maximum=1.0, value=0.9, step=0.05,
|
| 435 |
label="Color Strength",
|
|
|
|
| 436 |
info="0.5 = subtle tint · 1.0 = full vivid color"
|
| 437 |
)
|
| 438 |
col_btn = gr.Button("Colorize", variant="primary", size="lg")
|
| 439 |
with gr.Column():
|
| 440 |
+
col_output = gr.Image(label="Colorized Result", type="pil", interactive=False, height=350,)
|
|
|
|
| 441 |
|
| 442 |
col_btn.click(fn=colour_image, inputs=[col_input, col_strength], outputs=[col_output])
|
| 443 |
#----------Outpaint-----------------------------
|
| 444 |
with gr.Tab("Outpaint"):
|
| 445 |
+
gr.Markdown("""## Extend Any Scene
|
| 446 |
Upload an image and extend it in any direction.
|
| 447 |
BLIP reads the scene automatically — no prompt needed."""
|
| 448 |
)
|
|
|
|
| 466 |
)
|
| 467 |
out_btn = gr.Button("Outpaint", variant="primary", size="lg")
|
| 468 |
with gr.Column(scale=1):
|
| 469 |
+
out_output = gr.Image(label="Result", type="pil", interactive=False, height= 350,)
|
| 470 |
out_caption = gr.Textbox(label="Prompt Used", interactive=False, lines=4)
|
| 471 |
|
| 472 |
out_btn.click(
|