tmdwo commited on
Commit
9656130
·
verified ·
1 Parent(s): 59cbe26

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -63
app.py CHANGED
@@ -9,77 +9,18 @@ import matplotlib
9
  import matplotlib.pyplot as plt
10
  import pandas as pd
11
  from PIL import Image, ImageDraw
12
- from typing import Iterable
13
- from gradio.themes import Soft
14
- from gradio.themes.utils import colors, fonts, sizes
15
  from transformers import (
16
  Sam3Model, Sam3Processor,
17
  Sam3TrackerModel, Sam3TrackerProcessor
18
  )
19
 
20
  # ============ THEME SETUP ============
21
- colors.steel_blue = colors.Color(
22
- name="steel_blue",
23
- c50="#EBF3F8",
24
- c100="#D3E5F0",
25
- c200="#A8CCE1",
26
- c300="#7DB3D2",
27
- c400="#529AC3",
28
- c500="#4682B4",
29
- c600="#3E72A0",
30
- c700="#36638C",
31
- c800="#2E5378",
32
- c900="#264364",
33
- c950="#1E3450",
34
  )
35
 
36
- class CustomBlueTheme(Soft):
37
- def __init__(
38
- self,
39
- *,
40
- primary_hue: colors.Color | str = colors.gray,
41
- secondary_hue: colors.Color | str = colors.steel_blue,
42
- neutral_hue: colors.Color | str = colors.slate,
43
- text_size: sizes.Size | str = sizes.text_lg,
44
- font: fonts.Font | str | Iterable[fonts.Font | str] = (
45
- fonts.GoogleFont("Outfit"), "Arial", "sans-serif",
46
- ),
47
- font_mono: fonts.Font | str | Iterable[fonts.Font | str] = (
48
- fonts.GoogleFont("IBM Plex Mono"), "ui-monospace", "monospace",
49
- ),
50
- ):
51
- super().__init__(
52
- primary_hue=primary_hue,
53
- secondary_hue=secondary_hue,
54
- neutral_hue=neutral_hue,
55
- text_size=text_size,
56
- font=font,
57
- font_mono=font_mono,
58
- )
59
- super().set(
60
- background_fill_primary="*primary_50",
61
- background_fill_primary_dark="*primary_900",
62
- body_background_fill="linear-gradient(135deg, *primary_200, *primary_100)",
63
- body_background_fill_dark="linear-gradient(135deg, *primary_900, *primary_800)",
64
- button_primary_text_color="white",
65
- button_primary_text_color_hover="white",
66
- button_primary_background_fill="linear-gradient(90deg, *secondary_500, *secondary_600)",
67
- button_primary_background_fill_hover="linear-gradient(90deg, *secondary_600, *secondary_700)",
68
- button_primary_background_fill_dark="linear-gradient(90deg, *secondary_600, *secondary_700)",
69
- button_primary_background_fill_hover_dark="linear-gradient(90deg, *secondary_500, *secondary_600)",
70
- slider_color="*secondary_500",
71
- slider_color_dark="*secondary_600",
72
- block_title_text_weight="600",
73
- block_border_width="3px",
74
- block_shadow="*shadow_drop_lg",
75
- button_primary_shadow="*shadow_drop_lg",
76
- button_large_padding="11px",
77
- color_accent_soft="*primary_100",
78
- block_label_background_fill="*primary_200",
79
- )
80
-
81
- app_theme = CustomBlueTheme()
82
-
83
  # ============ GLOBAL SETUP ============
84
  device = "cuda" if torch.cuda.is_available() else "cpu"
85
  print(f"🖥️ Using compute device: {device}")
 
9
  import matplotlib.pyplot as plt
10
  import pandas as pd
11
  from PIL import Image, ImageDraw
 
 
 
12
  from transformers import (
13
  Sam3Model, Sam3Processor,
14
  Sam3TrackerModel, Sam3TrackerProcessor
15
  )
16
 
17
  # ============ THEME SETUP ============
18
+ # Use built-in Soft theme (custom theme causes API schema issues on HF Spaces)
19
+ app_theme = gr.themes.Soft(
20
+ primary_hue="blue",
21
+ secondary_hue="indigo",
 
 
 
 
 
 
 
 
 
22
  )
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  # ============ GLOBAL SETUP ============
25
  device = "cuda" if torch.cuda.is_available() else "cpu"
26
  print(f"🖥️ Using compute device: {device}")