prithivMLmods commited on
Commit
e5aedef
·
verified ·
1 Parent(s): a653a8d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -76
app.py CHANGED
@@ -4,77 +4,7 @@ from transformers import AutoProcessor, AutoModelForImageTextToText
4
  import spaces
5
  from molmo_utils import process_vision_info
6
  from typing import Iterable
7
- from gradio.themes import Soft
8
- from gradio.themes.utils import colors, fonts, sizes
9
-
10
- # ==========================================
11
- # 1. Custom Theme Definition
12
- # ==========================================
13
- colors.orange_red = colors.Color(
14
- name="orange_red",
15
- c50="#FFF0E5",
16
- c100="#FFE0CC",
17
- c200="#FFC299",
18
- c300="#FFA366",
19
- c400="#FF8533",
20
- c500="#FF4500",
21
- c600="#E63E00",
22
- c700="#CC3700",
23
- c800="#B33000",
24
- c900="#992900",
25
- c950="#802200",
26
- )
27
 
28
- class OrangeRedTheme(Soft):
29
- def __init__(
30
- self,
31
- *,
32
- primary_hue: colors.Color | str = colors.gray,
33
- secondary_hue: colors.Color | str = colors.orange_red,
34
- neutral_hue: colors.Color | str = colors.slate,
35
- text_size: sizes.Size | str = sizes.text_lg,
36
- font: fonts.Font | str | Iterable[fonts.Font | str] = (
37
- fonts.GoogleFont("Outfit"), "Arial", "sans-serif",
38
- ),
39
- font_mono: fonts.Font | str | Iterable[fonts.Font | str] = (
40
- fonts.GoogleFont("IBM Plex Mono"), "ui-monospace", "monospace",
41
- ),
42
- ):
43
- super().__init__(
44
- primary_hue=primary_hue,
45
- secondary_hue=secondary_hue,
46
- neutral_hue=neutral_hue,
47
- text_size=text_size,
48
- font=font,
49
- font_mono=font_mono,
50
- )
51
- super().set(
52
- background_fill_primary="*primary_50",
53
- background_fill_primary_dark="*primary_900",
54
- body_background_fill="linear-gradient(135deg, *primary_200, *primary_100)",
55
- body_background_fill_dark="linear-gradient(135deg, *primary_900, *primary_800)",
56
- button_primary_text_color="white",
57
- button_primary_text_color_hover="white",
58
- button_primary_background_fill="linear-gradient(90deg, *secondary_500, *secondary_600)",
59
- button_primary_background_fill_hover="linear-gradient(90deg, *secondary_600, *secondary_700)",
60
- button_primary_background_fill_dark="linear-gradient(90deg, *secondary_600, *secondary_700)",
61
- button_primary_background_fill_hover_dark="linear-gradient(90deg, *secondary_500, *secondary_600)",
62
- slider_color="*secondary_500",
63
- slider_color_dark="*secondary_600",
64
- block_title_text_weight="600",
65
- block_border_width="3px",
66
- block_shadow="*shadow_drop_lg",
67
- button_primary_shadow="*shadow_drop_lg",
68
- button_large_padding="11px",
69
- color_accent_soft="*primary_100",
70
- block_label_background_fill="*primary_200",
71
- )
72
-
73
- orange_red_theme = OrangeRedTheme()
74
-
75
- # ==========================================
76
- # 2. Model Loading
77
- # ==========================================
78
  MODEL_ID = "allenai/SAGE-MM-Qwen3-VL-8B-SFT_RL"
79
 
80
  print(f"Loading {MODEL_ID}...")
@@ -93,9 +23,6 @@ model = AutoModelForImageTextToText.from_pretrained(
93
  )
94
  print("Model loaded successfully.")
95
 
96
- # ==========================================
97
- # 3. Main Video Processing Function
98
- # ==========================================
99
  @spaces.GPU
100
  def process_video(user_text, video_path):
101
  if not video_path:
@@ -148,9 +75,6 @@ def process_video(user_text, video_path):
148
 
149
  return generated_text
150
 
151
- # ==========================================
152
- # 4. Gradio Interface
153
- # ==========================================
154
  css = """
155
  #col-container {
156
  margin: 0 auto;
 
4
  import spaces
5
  from molmo_utils import process_vision_info
6
  from typing import Iterable
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  MODEL_ID = "allenai/SAGE-MM-Qwen3-VL-8B-SFT_RL"
9
 
10
  print(f"Loading {MODEL_ID}...")
 
23
  )
24
  print("Model loaded successfully.")
25
 
 
 
 
26
  @spaces.GPU
27
  def process_video(user_text, video_path):
28
  if not video_path:
 
75
 
76
  return generated_text
77
 
 
 
 
78
  css = """
79
  #col-container {
80
  margin: 0 auto;