ghostsInTheMachine commited on
Commit
5a7c5d5
·
verified ·
1 Parent(s): 7d37659

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -19
app.py CHANGED
@@ -10,7 +10,7 @@ from PIL import Image, ImageOps
10
  from transformers import AutoModelForImageSegmentation
11
  from torchvision import transforms
12
 
13
- # Custom White Theme with Inter font
14
  class WhiteTheme(Base):
15
  def __init__(
16
  self,
@@ -36,20 +36,28 @@ class WhiteTheme(Base):
36
  )
37
 
38
  self.set(
 
 
 
 
 
 
39
  body_background_fill="white",
 
40
  block_background_fill="white",
 
41
  panel_background_fill="white",
 
42
  body_text_color="black",
 
43
  block_label_text_color="black",
 
44
  block_border_color="white",
45
  panel_border_color="white",
46
  input_border_color="lightgray",
47
- shadow_drop="none",
48
- button_primary_background_fill="*primary_500",
49
- button_primary_background_fill_hover="*primary_600",
50
- button_primary_text_color="white",
51
- button_secondary_background_fill="white",
52
- button_secondary_border_color="lightgray"
53
  )
54
 
55
  torch.set_float32_matmul_precision('high')
@@ -155,6 +163,17 @@ custom_css = """
155
  border-radius: 12px;
156
  color: black;
157
  }
 
 
 
 
 
 
 
 
 
 
 
158
  """
159
 
160
  with gr.Blocks(css=custom_css, theme=WhiteTheme()) as demo:
@@ -173,15 +192,4 @@ with gr.Blocks(css=custom_css, theme=WhiteTheme()) as demo:
173
  btn.click(fn=remove_background_wrapper, inputs=image_input, outputs=[
174
  output_foreground, output_background, output_foreground_mask, output_background_mask])
175
 
176
- # Force light theme using the correct JavaScript loading syntax
177
- demo.load(js="""
178
- () => {
179
- const params = new URLSearchParams(window.location.search);
180
- if (!params.has('__theme')) {
181
- params.set('__theme', 'light');
182
- window.location.search = params.toString();
183
- }
184
- }
185
- """)
186
-
187
- demo.launch(debug=True)
 
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,
 
36
  )
37
 
38
  self.set(
39
+ # Light mode specific colors
40
+ background_fill_primary="*primary_50",
41
+ background_fill_secondary="white",
42
+ border_color_primary="*primary_300",
43
+
44
+ # General colors that should stay constant
45
  body_background_fill="white",
46
+ body_background_fill_dark="white",
47
  block_background_fill="white",
48
+ block_background_fill_dark="white",
49
  panel_background_fill="white",
50
+ panel_background_fill_dark="white",
51
  body_text_color="black",
52
+ body_text_color_dark="black",
53
  block_label_text_color="black",
54
+ block_label_text_color_dark="black",
55
  block_border_color="white",
56
  panel_border_color="white",
57
  input_border_color="lightgray",
58
+ input_background_fill="white",
59
+ input_background_fill_dark="white",
60
+ shadow_drop="none"
 
 
 
61
  )
62
 
63
  torch.set_float32_matmul_precision('high')
 
163
  border-radius: 12px;
164
  color: black;
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;
172
+ --block-background-fill: white !important;
173
+ --panel-background-fill: white !important;
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
  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, dark=False)