Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,19 +27,22 @@ from transformers.image_utils import load_image
|
|
| 27 |
from gradio.themes import Soft
|
| 28 |
from gradio.themes.utils import colors, fonts, sizes
|
| 29 |
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
| 43 |
)
|
| 44 |
|
| 45 |
colors.red_gray = colors.Color(
|
|
@@ -49,12 +52,12 @@ colors.red_gray = colors.Color(
|
|
| 49 |
c800="#732d2d", c900="#5f2626", c950="#4d2020",
|
| 50 |
)
|
| 51 |
|
| 52 |
-
class
|
| 53 |
def __init__(
|
| 54 |
self,
|
| 55 |
*,
|
| 56 |
primary_hue: colors.Color | str = colors.gray,
|
| 57 |
-
secondary_hue: colors.Color | str = colors.
|
| 58 |
neutral_hue: colors.Color | str = colors.slate,
|
| 59 |
text_size: sizes.Size | str = sizes.text_lg,
|
| 60 |
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
|
@@ -77,27 +80,19 @@ class LightSalmonTheme(Soft):
|
|
| 77 |
background_fill_primary_dark="*primary_900",
|
| 78 |
body_background_fill="linear-gradient(135deg, *primary_200, *primary_100)",
|
| 79 |
body_background_fill_dark="linear-gradient(135deg, *primary_900, *primary_800)",
|
| 80 |
-
button_primary_text_color="
|
| 81 |
button_primary_text_color_hover="white",
|
| 82 |
-
button_primary_background_fill="linear-gradient(90deg, *
|
| 83 |
-
button_primary_background_fill_hover="linear-gradient(90deg, *secondary_600, *
|
| 84 |
-
button_primary_background_fill_dark="linear-gradient(90deg, *secondary_600, *
|
| 85 |
-
button_primary_background_fill_hover_dark="linear-gradient(90deg, *secondary_500, *
|
| 86 |
button_secondary_text_color="black",
|
| 87 |
button_secondary_text_color_hover="white",
|
| 88 |
button_secondary_background_fill="linear-gradient(90deg, *primary_300, *primary_300)",
|
| 89 |
button_secondary_background_fill_hover="linear-gradient(90deg, *primary_400, *primary_400)",
|
| 90 |
button_secondary_background_fill_dark="linear-gradient(90deg, *primary_500, *primary_600)",
|
| 91 |
button_secondary_background_fill_hover_dark="linear-gradient(90deg, *primary_500, *primary_500)",
|
| 92 |
-
|
| 93 |
-
button_cancel_background_fill_dark=f"linear-gradient(90deg, {colors.red_gray.c700}, {colors.red_gray.c800})",
|
| 94 |
-
button_cancel_background_fill_hover=f"linear-gradient(90deg, {colors.red_gray.c500}, {colors.red_gray.c600})",
|
| 95 |
-
button_cancel_background_fill_hover_dark=f"linear-gradient(90deg, {colors.red_gray.c800}, {colors.red_gray.c900})",
|
| 96 |
-
button_cancel_text_color="white",
|
| 97 |
-
button_cancel_text_color_dark="white",
|
| 98 |
-
button_cancel_text_color_hover="white",
|
| 99 |
-
button_cancel_text_color_hover_dark="white",
|
| 100 |
-
slider_color="*secondary_300",
|
| 101 |
slider_color_dark="*secondary_600",
|
| 102 |
block_title_text_weight="600",
|
| 103 |
block_border_width="3px",
|
|
@@ -108,7 +103,8 @@ class LightSalmonTheme(Soft):
|
|
| 108 |
block_label_background_fill="*primary_200",
|
| 109 |
)
|
| 110 |
|
| 111 |
-
|
|
|
|
| 112 |
|
| 113 |
css = """
|
| 114 |
#main-title h1 {
|
|
@@ -324,7 +320,7 @@ video_examples = [
|
|
| 324 |
["Explain the ad in detail.", "videos/1.mp4"]
|
| 325 |
]
|
| 326 |
|
| 327 |
-
with gr.Blocks(theme=
|
| 328 |
gr.Markdown("# **Multimodal VLM Thinking**", elem_id="main-title")
|
| 329 |
with gr.Row():
|
| 330 |
with gr.Column(scale=2):
|
|
|
|
| 27 |
from gradio.themes import Soft
|
| 28 |
from gradio.themes.utils import colors, fonts, sizes
|
| 29 |
|
| 30 |
+
# --- Theme and CSS Definition ---
|
| 31 |
+
|
| 32 |
+
# Define the new Red color palette
|
| 33 |
+
colors.red_theme = colors.Color(
|
| 34 |
+
name="red_theme",
|
| 35 |
+
c50="#FFE5E5",
|
| 36 |
+
c100="#FFCCCC",
|
| 37 |
+
c200="#FF9999",
|
| 38 |
+
c300="#FF6666",
|
| 39 |
+
c400="#FF3333",
|
| 40 |
+
c500="#FF0000", # Red base color
|
| 41 |
+
c600="#D90000",
|
| 42 |
+
c700="#B30000",
|
| 43 |
+
c800="#8C0000",
|
| 44 |
+
c900="#660000",
|
| 45 |
+
c950="#400000",
|
| 46 |
)
|
| 47 |
|
| 48 |
colors.red_gray = colors.Color(
|
|
|
|
| 52 |
c800="#732d2d", c900="#5f2626", c950="#4d2020",
|
| 53 |
)
|
| 54 |
|
| 55 |
+
class RedTheme(Soft):
|
| 56 |
def __init__(
|
| 57 |
self,
|
| 58 |
*,
|
| 59 |
primary_hue: colors.Color | str = colors.gray,
|
| 60 |
+
secondary_hue: colors.Color | str = colors.red_theme, # Use the new red color
|
| 61 |
neutral_hue: colors.Color | str = colors.slate,
|
| 62 |
text_size: sizes.Size | str = sizes.text_lg,
|
| 63 |
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
|
|
|
| 80 |
background_fill_primary_dark="*primary_900",
|
| 81 |
body_background_fill="linear-gradient(135deg, *primary_200, *primary_100)",
|
| 82 |
body_background_fill_dark="linear-gradient(135deg, *primary_900, *primary_800)",
|
| 83 |
+
button_primary_text_color="white",
|
| 84 |
button_primary_text_color_hover="white",
|
| 85 |
+
button_primary_background_fill="linear-gradient(90deg, *secondary_500, *secondary_600)",
|
| 86 |
+
button_primary_background_fill_hover="linear-gradient(90deg, *secondary_600, *secondary_700)",
|
| 87 |
+
button_primary_background_fill_dark="linear-gradient(90deg, *secondary_600, *secondary_700)",
|
| 88 |
+
button_primary_background_fill_hover_dark="linear-gradient(90deg, *secondary_500, *secondary_600)",
|
| 89 |
button_secondary_text_color="black",
|
| 90 |
button_secondary_text_color_hover="white",
|
| 91 |
button_secondary_background_fill="linear-gradient(90deg, *primary_300, *primary_300)",
|
| 92 |
button_secondary_background_fill_hover="linear-gradient(90deg, *primary_400, *primary_400)",
|
| 93 |
button_secondary_background_fill_dark="linear-gradient(90deg, *primary_500, *primary_600)",
|
| 94 |
button_secondary_background_fill_hover_dark="linear-gradient(90deg, *primary_500, *primary_500)",
|
| 95 |
+
slider_color="*secondary_500",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
slider_color_dark="*secondary_600",
|
| 97 |
block_title_text_weight="600",
|
| 98 |
block_border_width="3px",
|
|
|
|
| 103 |
block_label_background_fill="*primary_200",
|
| 104 |
)
|
| 105 |
|
| 106 |
+
# Instantiate the new theme
|
| 107 |
+
red_theme = RedTheme()
|
| 108 |
|
| 109 |
css = """
|
| 110 |
#main-title h1 {
|
|
|
|
| 320 |
["Explain the ad in detail.", "videos/1.mp4"]
|
| 321 |
]
|
| 322 |
|
| 323 |
+
with gr.Blocks(theme=red_theme, css=css) as demo:
|
| 324 |
gr.Markdown("# **Multimodal VLM Thinking**", elem_id="main-title")
|
| 325 |
with gr.Row():
|
| 326 |
with gr.Column(scale=2):
|