Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -143,8 +143,30 @@ def remove_background(image_ori):
|
|
| 143 |
|
| 144 |
return foreground, background, pred_pil, reverse_mask
|
| 145 |
|
| 146 |
-
# Custom CSS for
|
| 147 |
custom_css = """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
@keyframes gradient-animation {
|
| 149 |
0% { background-position: 0% 50%; }
|
| 150 |
50% { background-position: 100% 50%; }
|
|
@@ -183,11 +205,37 @@ custom_css = """
|
|
| 183 |
"""
|
| 184 |
|
| 185 |
with gr.Blocks(css=custom_css, theme=WhiteTheme()) as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
# Interface setup with input and output
|
| 187 |
with gr.Row():
|
| 188 |
with gr.Column():
|
| 189 |
image_input = gr.Image(type="numpy", sources=['upload'], label="Upload Image")
|
| 190 |
btn = gr.Button("Process Image", elem_id="submit-button")
|
|
|
|
| 191 |
with gr.Column():
|
| 192 |
output_foreground = gr.Image(type="pil", label="Foreground")
|
| 193 |
output_background = gr.Image(type="pil", label="Background")
|
|
|
|
| 143 |
|
| 144 |
return foreground, background, pred_pil, reverse_mask
|
| 145 |
|
| 146 |
+
# Custom CSS for styling
|
| 147 |
custom_css = """
|
| 148 |
+
.title-container {
|
| 149 |
+
text-align: center;
|
| 150 |
+
padding: 10px 0;
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
#title {
|
| 154 |
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
| 155 |
+
font-size: 36px;
|
| 156 |
+
font-weight: bold;
|
| 157 |
+
color: #000000;
|
| 158 |
+
padding: 10px;
|
| 159 |
+
border-radius: 10px;
|
| 160 |
+
display: inline-block;
|
| 161 |
+
background: linear-gradient(
|
| 162 |
+
135deg,
|
| 163 |
+
#e0f7fa, #e8f5e9, #fff9c4, #ffebee,
|
| 164 |
+
#f3e5f5, #e1f5fe, #fff3e0, #e8eaf6
|
| 165 |
+
);
|
| 166 |
+
background-size: 400% 400%;
|
| 167 |
+
animation: gradient-animation 15s ease infinite;
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
@keyframes gradient-animation {
|
| 171 |
0% { background-position: 0% 50%; }
|
| 172 |
50% { background-position: 100% 50%; }
|
|
|
|
| 205 |
"""
|
| 206 |
|
| 207 |
with gr.Blocks(css=custom_css, theme=WhiteTheme()) as demo:
|
| 208 |
+
gr.HTML('''
|
| 209 |
+
<div class="title-container">
|
| 210 |
+
<div id="title">
|
| 211 |
+
<span>{.</span><span id="typed-text"></span><span>}</span>
|
| 212 |
+
</div>
|
| 213 |
+
</div>
|
| 214 |
+
<script>
|
| 215 |
+
(function() {
|
| 216 |
+
const text = "video";
|
| 217 |
+
const typedTextSpan = document.getElementById("typed-text");
|
| 218 |
+
let charIndex = 0;
|
| 219 |
+
|
| 220 |
+
function type() {
|
| 221 |
+
if (charIndex < text.length) {
|
| 222 |
+
typedTextSpan.textContent += text[charIndex];
|
| 223 |
+
charIndex++;
|
| 224 |
+
setTimeout(type, 150);
|
| 225 |
+
}
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
setTimeout(type, 150);
|
| 229 |
+
})();
|
| 230 |
+
</script>
|
| 231 |
+
''')
|
| 232 |
+
|
| 233 |
# Interface setup with input and output
|
| 234 |
with gr.Row():
|
| 235 |
with gr.Column():
|
| 236 |
image_input = gr.Image(type="numpy", sources=['upload'], label="Upload Image")
|
| 237 |
btn = gr.Button("Process Image", elem_id="submit-button")
|
| 238 |
+
|
| 239 |
with gr.Column():
|
| 240 |
output_foreground = gr.Image(type="pil", label="Foreground")
|
| 241 |
output_background = gr.Image(type="pil", label="Background")
|