Spaces:
Running
Running
anhth commited on
Commit ·
89fffaa
1
Parent(s): 7add99b
Update better UI
Browse files
app.py
CHANGED
|
@@ -46,40 +46,10 @@ model.fuse()
|
|
| 46 |
model.eval()
|
| 47 |
|
| 48 |
# Create the Gradio interface
|
| 49 |
-
|
| 50 |
-
custom_css = """
|
| 51 |
-
body {
|
| 52 |
-
background: linear-gradient(135deg, #1e1e2f, #2a2a40);
|
| 53 |
-
color: white;
|
| 54 |
-
}
|
| 55 |
-
.gradio-container {
|
| 56 |
-
max-width: 1000px !important;
|
| 57 |
-
margin: auto;
|
| 58 |
-
}
|
| 59 |
-
.header {
|
| 60 |
-
text-align: center;
|
| 61 |
-
padding: 20px;
|
| 62 |
-
}
|
| 63 |
-
.header h1 {
|
| 64 |
-
font-size: 2.2rem;
|
| 65 |
-
margin-bottom: 5px;
|
| 66 |
-
}
|
| 67 |
-
.header p {
|
| 68 |
-
color: #cfcfe0;
|
| 69 |
-
}
|
| 70 |
-
.button-primary {
|
| 71 |
-
background: linear-gradient(90deg, #ff7a18, #ffb347);
|
| 72 |
-
border: none;
|
| 73 |
-
color: white;
|
| 74 |
-
font-weight: bold;
|
| 75 |
-
}
|
| 76 |
-
"""
|
| 77 |
-
|
| 78 |
-
with gr.Blocks(css=custom_css) as demo:
|
| 79 |
# Header
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
gr.Markdown("Bring your grayscale comics to life with **ColorComicNet**")
|
| 83 |
with gr.Row(equal_height=True):
|
| 84 |
with gr.Column(scale=1):
|
| 85 |
input_image = gr.Image(
|
|
@@ -90,32 +60,27 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 90 |
"✨ Colorize Image",
|
| 91 |
elem_classes="button-primary"
|
| 92 |
)
|
| 93 |
-
|
| 94 |
with gr.Column(scale=1):
|
| 95 |
output_image = gr.Image(
|
| 96 |
label="📤 Colorized Result",
|
| 97 |
type="numpy",
|
| 98 |
)
|
| 99 |
-
|
| 100 |
# Example section
|
| 101 |
gr.Markdown("### 🖼️ Try an example")
|
| 102 |
examples = gr.Examples(
|
| 103 |
examples=[
|
| 104 |
-
["gray.jpg"],
|
| 105 |
-
["gray_2.jpg"],
|
| 106 |
-
["gray_4.jpg"],
|
| 107 |
],
|
| 108 |
inputs=input_image
|
| 109 |
)
|
| 110 |
-
|
| 111 |
# Footer
|
| 112 |
gr.Markdown("---")
|
| 113 |
-
|
| 114 |
# Interaction
|
| 115 |
colorize_button.click(
|
| 116 |
fn=colorize_image,
|
| 117 |
inputs=input_image,
|
| 118 |
outputs=output_image
|
| 119 |
)
|
| 120 |
-
|
| 121 |
demo.launch()
|
|
|
|
| 46 |
model.eval()
|
| 47 |
|
| 48 |
# Create the Gradio interface
|
| 49 |
+
with gr.Blocks() as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
# Header
|
| 51 |
+
gr.Markdown("# 🎨 Comic Colorization")
|
| 52 |
+
gr.Markdown("Bring your grayscale comics to life with **ColorComicNet**")
|
|
|
|
| 53 |
with gr.Row(equal_height=True):
|
| 54 |
with gr.Column(scale=1):
|
| 55 |
input_image = gr.Image(
|
|
|
|
| 60 |
"✨ Colorize Image",
|
| 61 |
elem_classes="button-primary"
|
| 62 |
)
|
|
|
|
| 63 |
with gr.Column(scale=1):
|
| 64 |
output_image = gr.Image(
|
| 65 |
label="📤 Colorized Result",
|
| 66 |
type="numpy",
|
| 67 |
)
|
|
|
|
| 68 |
# Example section
|
| 69 |
gr.Markdown("### 🖼️ Try an example")
|
| 70 |
examples = gr.Examples(
|
| 71 |
examples=[
|
| 72 |
+
["./examples/gray.jpg"],
|
| 73 |
+
["./examples/gray_2.jpg"],
|
| 74 |
+
["./examples/gray_4.jpg"],
|
| 75 |
],
|
| 76 |
inputs=input_image
|
| 77 |
)
|
|
|
|
| 78 |
# Footer
|
| 79 |
gr.Markdown("---")
|
|
|
|
| 80 |
# Interaction
|
| 81 |
colorize_button.click(
|
| 82 |
fn=colorize_image,
|
| 83 |
inputs=input_image,
|
| 84 |
outputs=output_image
|
| 85 |
)
|
|
|
|
| 86 |
demo.launch()
|