Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,6 @@ from PIL import Image, ImageOps
|
|
| 10 |
from transformers import AutoModelForImageSegmentation
|
| 11 |
from torchvision import transforms
|
| 12 |
|
| 13 |
-
# Custom White Theme with Inter font and explicit light mode colors
|
| 14 |
class WhiteTheme(Base):
|
| 15 |
def __init__(
|
| 16 |
self,
|
|
@@ -144,7 +143,7 @@ def remove_background(image_ori):
|
|
| 144 |
|
| 145 |
return foreground, background, pred_pil, reverse_mask
|
| 146 |
|
| 147 |
-
# Custom CSS for button styling
|
| 148 |
custom_css = """
|
| 149 |
@keyframes gradient-animation {
|
| 150 |
0% { background-position: 0% 50%; }
|
|
@@ -165,7 +164,7 @@ custom_css = """
|
|
| 165 |
}
|
| 166 |
|
| 167 |
/* Force light mode styles */
|
| 168 |
-
:root {
|
| 169 |
--body-background-fill: white !important;
|
| 170 |
--background-fill-primary: white !important;
|
| 171 |
--background-fill-secondary: white !important;
|
|
@@ -174,6 +173,13 @@ custom_css = """
|
|
| 174 |
--body-text-color: black !important;
|
| 175 |
--block-label-text-color: black !important;
|
| 176 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
"""
|
| 178 |
|
| 179 |
with gr.Blocks(css=custom_css, theme=WhiteTheme()) as demo:
|
|
@@ -192,4 +198,4 @@ with gr.Blocks(css=custom_css, theme=WhiteTheme()) as demo:
|
|
| 192 |
btn.click(fn=remove_background_wrapper, inputs=image_input, outputs=[
|
| 193 |
output_foreground, output_background, output_foreground_mask, output_background_mask])
|
| 194 |
|
| 195 |
-
demo.launch(debug=True
|
|
|
|
| 10 |
from transformers import AutoModelForImageSegmentation
|
| 11 |
from torchvision import transforms
|
| 12 |
|
|
|
|
| 13 |
class WhiteTheme(Base):
|
| 14 |
def __init__(
|
| 15 |
self,
|
|
|
|
| 143 |
|
| 144 |
return foreground, background, pred_pil, reverse_mask
|
| 145 |
|
| 146 |
+
# Custom CSS for button styling with additional light mode enforcement
|
| 147 |
custom_css = """
|
| 148 |
@keyframes gradient-animation {
|
| 149 |
0% { background-position: 0% 50%; }
|
|
|
|
| 164 |
}
|
| 165 |
|
| 166 |
/* Force light mode styles */
|
| 167 |
+
:root, :root[data-theme='light'], :root[data-theme='dark'] {
|
| 168 |
--body-background-fill: white !important;
|
| 169 |
--background-fill-primary: white !important;
|
| 170 |
--background-fill-secondary: white !important;
|
|
|
|
| 173 |
--body-text-color: black !important;
|
| 174 |
--block-label-text-color: black !important;
|
| 175 |
}
|
| 176 |
+
|
| 177 |
+
/* Additional overrides for dark mode */
|
| 178 |
+
@media (prefers-color-scheme: dark) {
|
| 179 |
+
:root {
|
| 180 |
+
color-scheme: light;
|
| 181 |
+
}
|
| 182 |
+
}
|
| 183 |
"""
|
| 184 |
|
| 185 |
with gr.Blocks(css=custom_css, theme=WhiteTheme()) as demo:
|
|
|
|
| 198 |
btn.click(fn=remove_background_wrapper, inputs=image_input, outputs=[
|
| 199 |
output_foreground, output_background, output_foreground_mask, output_background_mask])
|
| 200 |
|
| 201 |
+
demo.launch(debug=True)
|