Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,28 +20,27 @@ except ImportError:
|
|
| 20 |
return func
|
| 21 |
return decorator
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
c950="#2B122B",
|
| 37 |
)
|
| 38 |
|
| 39 |
-
class
|
| 40 |
def __init__(
|
| 41 |
self,
|
| 42 |
*,
|
| 43 |
-
primary_hue: colors.Color | str = colors.
|
| 44 |
-
secondary_hue: colors.Color | str = colors.
|
| 45 |
neutral_hue: colors.Color | str = colors.slate,
|
| 46 |
text_size: sizes.Size | str = sizes.text_lg,
|
| 47 |
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
|
@@ -59,25 +58,19 @@ class PlumTheme(Soft):
|
|
| 59 |
font=font,
|
| 60 |
font_mono=font_mono,
|
| 61 |
)
|
| 62 |
-
|
| 63 |
background_fill_primary="*primary_50",
|
| 64 |
background_fill_primary_dark="*primary_900",
|
| 65 |
-
body_background_fill="linear-gradient(135deg, *
|
| 66 |
body_background_fill_dark="linear-gradient(135deg, *primary_900, *primary_800)",
|
| 67 |
button_primary_text_color="white",
|
| 68 |
button_primary_text_color_hover="white",
|
| 69 |
-
button_primary_background_fill="linear-gradient(90deg, *
|
| 70 |
-
button_primary_background_fill_hover="linear-gradient(90deg, *
|
| 71 |
-
button_primary_background_fill_dark="linear-gradient(90deg, *
|
| 72 |
-
button_primary_background_fill_hover_dark="linear-gradient(90deg, *
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
button_secondary_background_fill="linear-gradient(90deg, *primary_200, *primary_200)",
|
| 76 |
-
button_secondary_background_fill_hover="linear-gradient(90deg, *primary_400, *primary_400)",
|
| 77 |
-
button_secondary_background_fill_dark="linear-gradient(90deg, *primary_500, *primary_600)",
|
| 78 |
-
button_secondary_background_fill_hover_dark="linear-gradient(90deg, *primary_500, *primary_500)",
|
| 79 |
-
slider_color="*primary_500",
|
| 80 |
-
slider_color_dark="*primary_600",
|
| 81 |
block_title_text_weight="600",
|
| 82 |
block_border_width="3px",
|
| 83 |
block_shadow="*shadow_drop_lg",
|
|
@@ -87,7 +80,7 @@ class PlumTheme(Soft):
|
|
| 87 |
block_label_background_fill="*primary_200",
|
| 88 |
)
|
| 89 |
|
| 90 |
-
|
| 91 |
|
| 92 |
# --- Hardware Setup ---
|
| 93 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
@@ -164,7 +157,7 @@ css="""
|
|
| 164 |
#main-title h1 {font-size: 2.1em !important;}
|
| 165 |
"""
|
| 166 |
|
| 167 |
-
with gr.Blocks(css=css, theme=
|
| 168 |
with gr.Column(elem_id="col-container"):
|
| 169 |
gr.Markdown(
|
| 170 |
"# **SAM3 Image Segmentation**",
|
|
|
|
| 20 |
return func
|
| 21 |
return decorator
|
| 22 |
|
| 23 |
+
colors.steel_blue = colors.Color(
|
| 24 |
+
name="steel_blue",
|
| 25 |
+
c50="#EBF3F8",
|
| 26 |
+
c100="#D3E5F0",
|
| 27 |
+
c200="#A8CCE1",
|
| 28 |
+
c300="#7DB3D2",
|
| 29 |
+
c400="#529AC3",
|
| 30 |
+
c500="#4682B4",
|
| 31 |
+
c600="#3E72A0",
|
| 32 |
+
c700="#36638C",
|
| 33 |
+
c800="#2E5378",
|
| 34 |
+
c900="#264364",
|
| 35 |
+
c950="#1E3450",
|
|
|
|
| 36 |
)
|
| 37 |
|
| 38 |
+
class SteelBlueTheme(Soft):
|
| 39 |
def __init__(
|
| 40 |
self,
|
| 41 |
*,
|
| 42 |
+
primary_hue: colors.Color | str = colors.gray,
|
| 43 |
+
secondary_hue: colors.Color | str = colors.steel_blue,
|
| 44 |
neutral_hue: colors.Color | str = colors.slate,
|
| 45 |
text_size: sizes.Size | str = sizes.text_lg,
|
| 46 |
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
|
|
|
| 58 |
font=font,
|
| 59 |
font_mono=font_mono,
|
| 60 |
)
|
| 61 |
+
super().set(
|
| 62 |
background_fill_primary="*primary_50",
|
| 63 |
background_fill_primary_dark="*primary_900",
|
| 64 |
+
body_background_fill="linear-gradient(135deg, *primary_200, *primary_100)",
|
| 65 |
body_background_fill_dark="linear-gradient(135deg, *primary_900, *primary_800)",
|
| 66 |
button_primary_text_color="white",
|
| 67 |
button_primary_text_color_hover="white",
|
| 68 |
+
button_primary_background_fill="linear-gradient(90deg, *secondary_500, *secondary_600)",
|
| 69 |
+
button_primary_background_fill_hover="linear-gradient(90deg, *secondary_600, *secondary_700)",
|
| 70 |
+
button_primary_background_fill_dark="linear-gradient(90deg, *secondary_600, *secondary_700)",
|
| 71 |
+
button_primary_background_fill_hover_dark="linear-gradient(90deg, *secondary_500, *secondary_600)",
|
| 72 |
+
slider_color="*secondary_500",
|
| 73 |
+
slider_color_dark="*secondary_600",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
block_title_text_weight="600",
|
| 75 |
block_border_width="3px",
|
| 76 |
block_shadow="*shadow_drop_lg",
|
|
|
|
| 80 |
block_label_background_fill="*primary_200",
|
| 81 |
)
|
| 82 |
|
| 83 |
+
steel_blue_theme = SteelBlueTheme()
|
| 84 |
|
| 85 |
# --- Hardware Setup ---
|
| 86 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
|
| 157 |
#main-title h1 {font-size: 2.1em !important;}
|
| 158 |
"""
|
| 159 |
|
| 160 |
+
with gr.Blocks(css=css, theme=steel_blue_theme) as demo:
|
| 161 |
with gr.Column(elem_id="col-container"):
|
| 162 |
gr.Markdown(
|
| 163 |
"# **SAM3 Image Segmentation**",
|