Spaces:
Running
on
Zero
Running
on
Zero
update app
Browse files
app.py
CHANGED
|
@@ -28,11 +28,22 @@ from transformers.image_utils import load_image
|
|
| 28 |
from gradio.themes import Soft
|
| 29 |
from gradio.themes.utils import colors, fonts, sizes
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
)
|
| 37 |
|
| 38 |
colors.red_gray = colors.Color(
|
|
@@ -42,12 +53,12 @@ colors.red_gray = colors.Color(
|
|
| 42 |
c800="#732d2d", c900="#5f2626", c950="#4d2020",
|
| 43 |
)
|
| 44 |
|
| 45 |
-
class
|
| 46 |
def __init__(
|
| 47 |
self,
|
| 48 |
*,
|
| 49 |
primary_hue: colors.Color | str = colors.gray,
|
| 50 |
-
secondary_hue: colors.Color | str = colors.
|
| 51 |
neutral_hue: colors.Color | str = colors.slate,
|
| 52 |
text_size: sizes.Size | str = sizes.text_lg,
|
| 53 |
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
|
@@ -70,27 +81,19 @@ class ThistleTheme(Soft):
|
|
| 70 |
background_fill_primary_dark="*primary_900",
|
| 71 |
body_background_fill="linear-gradient(135deg, *primary_200, *primary_100)",
|
| 72 |
body_background_fill_dark="linear-gradient(135deg, *primary_900, *primary_800)",
|
| 73 |
-
button_primary_text_color="
|
| 74 |
button_primary_text_color_hover="white",
|
| 75 |
-
button_primary_background_fill="linear-gradient(90deg, *
|
| 76 |
-
button_primary_background_fill_hover="linear-gradient(90deg, *secondary_600, *
|
| 77 |
-
button_primary_background_fill_dark="linear-gradient(90deg, *secondary_600, *
|
| 78 |
-
button_primary_background_fill_hover_dark="linear-gradient(90deg, *secondary_500, *
|
| 79 |
button_secondary_text_color="black",
|
| 80 |
button_secondary_text_color_hover="white",
|
| 81 |
button_secondary_background_fill="linear-gradient(90deg, *primary_300, *primary_300)",
|
| 82 |
button_secondary_background_fill_hover="linear-gradient(90deg, *primary_400, *primary_400)",
|
| 83 |
button_secondary_background_fill_dark="linear-gradient(90deg, *primary_500, *primary_600)",
|
| 84 |
button_secondary_background_fill_hover_dark="linear-gradient(90deg, *primary_500, *primary_500)",
|
| 85 |
-
|
| 86 |
-
button_cancel_background_fill_dark=f"linear-gradient(90deg, {colors.red_gray.c700}, {colors.red_gray.c800})",
|
| 87 |
-
button_cancel_background_fill_hover=f"linear-gradient(90deg, {colors.red_gray.c500}, {colors.red_gray.c600})",
|
| 88 |
-
button_cancel_background_fill_hover_dark=f"linear-gradient(90deg, {colors.red_gray.c800}, {colors.red_gray.c900})",
|
| 89 |
-
button_cancel_text_color="white",
|
| 90 |
-
button_cancel_text_color_dark="white",
|
| 91 |
-
button_cancel_text_color_hover="white",
|
| 92 |
-
button_cancel_text_color_hover_dark="white",
|
| 93 |
-
slider_color="*secondary_300",
|
| 94 |
slider_color_dark="*secondary_600",
|
| 95 |
block_title_text_weight="600",
|
| 96 |
block_border_width="3px",
|
|
@@ -101,7 +104,8 @@ class ThistleTheme(Soft):
|
|
| 101 |
block_label_background_fill="*primary_200",
|
| 102 |
)
|
| 103 |
|
| 104 |
-
|
|
|
|
| 105 |
|
| 106 |
css = """
|
| 107 |
#main-title h1 {
|
|
@@ -387,7 +391,7 @@ gif_examples = [["Describe this GIF.", "examples/gifs/1.gif"],
|
|
| 387 |
caption_examples = [["examples/captions/1.JPG"],
|
| 388 |
["examples/captions/2.jpeg"], ["examples/captions/3.jpeg"]]
|
| 389 |
|
| 390 |
-
with gr.Blocks(theme=
|
| 391 |
pdf_state = gr.State(value=get_initial_pdf_state())
|
| 392 |
gr.Markdown("# **Qwen-3VL:Multimodal**", elem_id="main-title")
|
| 393 |
with gr.Row():
|
|
|
|
| 28 |
from gradio.themes import Soft
|
| 29 |
from gradio.themes.utils import colors, fonts, sizes
|
| 30 |
|
| 31 |
+
# --- Theme and CSS Definition ---
|
| 32 |
+
|
| 33 |
+
# Define the new OrangeRed color palette
|
| 34 |
+
colors.orange_red = colors.Color(
|
| 35 |
+
name="orange_red",
|
| 36 |
+
c50="#FFEDE5",
|
| 37 |
+
c100="#FFDBCB",
|
| 38 |
+
c200="#FFB899",
|
| 39 |
+
c300="#FF9466",
|
| 40 |
+
c400="#FF7133",
|
| 41 |
+
c500="#FF4500", # OrangeRed base color
|
| 42 |
+
c600="#E63E00",
|
| 43 |
+
c700="#CC3700",
|
| 44 |
+
c800="#B33000",
|
| 45 |
+
c900="#992900",
|
| 46 |
+
c950="#802200",
|
| 47 |
)
|
| 48 |
|
| 49 |
colors.red_gray = colors.Color(
|
|
|
|
| 53 |
c800="#732d2d", c900="#5f2626", c950="#4d2020",
|
| 54 |
)
|
| 55 |
|
| 56 |
+
class OrangeRedTheme(Soft):
|
| 57 |
def __init__(
|
| 58 |
self,
|
| 59 |
*,
|
| 60 |
primary_hue: colors.Color | str = colors.gray,
|
| 61 |
+
secondary_hue: colors.Color | str = colors.orange_red, # Use the new color
|
| 62 |
neutral_hue: colors.Color | str = colors.slate,
|
| 63 |
text_size: sizes.Size | str = sizes.text_lg,
|
| 64 |
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
|
|
|
| 81 |
background_fill_primary_dark="*primary_900",
|
| 82 |
body_background_fill="linear-gradient(135deg, *primary_200, *primary_100)",
|
| 83 |
body_background_fill_dark="linear-gradient(135deg, *primary_900, *primary_800)",
|
| 84 |
+
button_primary_text_color="white",
|
| 85 |
button_primary_text_color_hover="white",
|
| 86 |
+
button_primary_background_fill="linear-gradient(90deg, *secondary_500, *secondary_600)",
|
| 87 |
+
button_primary_background_fill_hover="linear-gradient(90deg, *secondary_600, *secondary_700)",
|
| 88 |
+
button_primary_background_fill_dark="linear-gradient(90deg, *secondary_600, *secondary_700)",
|
| 89 |
+
button_primary_background_fill_hover_dark="linear-gradient(90deg, *secondary_500, *secondary_600)",
|
| 90 |
button_secondary_text_color="black",
|
| 91 |
button_secondary_text_color_hover="white",
|
| 92 |
button_secondary_background_fill="linear-gradient(90deg, *primary_300, *primary_300)",
|
| 93 |
button_secondary_background_fill_hover="linear-gradient(90deg, *primary_400, *primary_400)",
|
| 94 |
button_secondary_background_fill_dark="linear-gradient(90deg, *primary_500, *primary_600)",
|
| 95 |
button_secondary_background_fill_hover_dark="linear-gradient(90deg, *primary_500, *primary_500)",
|
| 96 |
+
slider_color="*secondary_500",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
slider_color_dark="*secondary_600",
|
| 98 |
block_title_text_weight="600",
|
| 99 |
block_border_width="3px",
|
|
|
|
| 104 |
block_label_background_fill="*primary_200",
|
| 105 |
)
|
| 106 |
|
| 107 |
+
# Instantiate the new theme
|
| 108 |
+
orange_red_theme = OrangeRedTheme()
|
| 109 |
|
| 110 |
css = """
|
| 111 |
#main-title h1 {
|
|
|
|
| 391 |
caption_examples = [["examples/captions/1.JPG"],
|
| 392 |
["examples/captions/2.jpeg"], ["examples/captions/3.jpeg"]]
|
| 393 |
|
| 394 |
+
with gr.Blocks(theme=orange_red_theme, css=css) as demo:
|
| 395 |
pdf_state = gr.State(value=get_initial_pdf_state())
|
| 396 |
gr.Markdown("# **Qwen-3VL:Multimodal**", elem_id="main-title")
|
| 397 |
with gr.Row():
|