Spaces:
Running
on
Zero
Running
on
Zero
update app
Browse files
app.py
CHANGED
|
@@ -30,20 +30,20 @@ from gradio.themes.utils import colors, fonts, sizes
|
|
| 30 |
|
| 31 |
# --- Theme and CSS Definition ---
|
| 32 |
|
| 33 |
-
# Define the
|
| 34 |
-
colors.
|
| 35 |
-
name="
|
| 36 |
-
c50="#
|
| 37 |
-
c100="#
|
| 38 |
-
c200="#
|
| 39 |
-
c300="#
|
| 40 |
-
c400="#
|
| 41 |
-
c500="#
|
| 42 |
-
c600="#
|
| 43 |
-
c700="#
|
| 44 |
-
c800="#
|
| 45 |
-
c900="#
|
| 46 |
-
c950="#
|
| 47 |
)
|
| 48 |
|
| 49 |
colors.red_gray = colors.Color(
|
|
@@ -53,12 +53,12 @@ colors.red_gray = colors.Color(
|
|
| 53 |
c800="#732d2d", c900="#5f2626", c950="#4d2020",
|
| 54 |
)
|
| 55 |
|
| 56 |
-
class
|
| 57 |
def __init__(
|
| 58 |
self,
|
| 59 |
*,
|
| 60 |
primary_hue: colors.Color | str = colors.gray,
|
| 61 |
-
secondary_hue: colors.Color | str = colors.
|
| 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,10 +81,10 @@ class DeepSkyBlueTheme(Soft):
|
|
| 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="
|
| 85 |
button_primary_text_color_hover="white",
|
| 86 |
-
button_primary_background_fill="linear-gradient(90deg, *
|
| 87 |
-
button_primary_background_fill_hover="linear-gradient(90deg, *
|
| 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",
|
|
@@ -93,7 +93,7 @@ class DeepSkyBlueTheme(Soft):
|
|
| 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="*
|
| 97 |
slider_color_dark="*secondary_600",
|
| 98 |
block_title_text_weight="600",
|
| 99 |
block_border_width="3px",
|
|
@@ -105,7 +105,7 @@ class DeepSkyBlueTheme(Soft):
|
|
| 105 |
)
|
| 106 |
|
| 107 |
# Instantiate the new theme
|
| 108 |
-
|
| 109 |
|
| 110 |
css = """
|
| 111 |
#main-title h1 {
|
|
@@ -377,7 +377,6 @@ def generate_gif(text: str, gif_path: str, max_new_tokens: int = 1024, temperatu
|
|
| 377 |
time.sleep(0.01)
|
| 378 |
yield buffer, buffer
|
| 379 |
|
| 380 |
-
# examples
|
| 381 |
image_examples = [["Perform OCR on the image...", "examples/images/1.jpg"],
|
| 382 |
["Caption the image. Describe the safety measures shown in the image. Conclude whether the situation is (safe or unsafe)...", "examples/images/2.jpg"],
|
| 383 |
["Solve the problem...", "examples/images/3.png"]]
|
|
@@ -392,7 +391,7 @@ gif_examples = [["Describe this GIF.", "examples/gifs/1.gif"],
|
|
| 392 |
caption_examples = [["examples/captions/1.JPG"],
|
| 393 |
["examples/captions/2.jpeg"], ["examples/captions/3.jpeg"]]
|
| 394 |
|
| 395 |
-
with gr.Blocks(theme=
|
| 396 |
pdf_state = gr.State(value=get_initial_pdf_state())
|
| 397 |
gr.Markdown("# **Qwen-3VL:Multimodal**", elem_id="main-title")
|
| 398 |
with gr.Row():
|
|
|
|
| 30 |
|
| 31 |
# --- Theme and CSS Definition ---
|
| 32 |
|
| 33 |
+
# Define the Thistle color palette
|
| 34 |
+
colors.thistle = colors.Color(
|
| 35 |
+
name="thistle",
|
| 36 |
+
c50="#F9F5F9",
|
| 37 |
+
c100="#F0E8F1",
|
| 38 |
+
c200="#E7DBE8",
|
| 39 |
+
c300="#DECEE0",
|
| 40 |
+
c400="#D2BFD8",
|
| 41 |
+
c500="#D8BFD8", # Thistle base color
|
| 42 |
+
c600="#B59CB7",
|
| 43 |
+
c700="#927996",
|
| 44 |
+
c800="#6F5675",
|
| 45 |
+
c900="#4C3454",
|
| 46 |
+
c950="#291233",
|
| 47 |
)
|
| 48 |
|
| 49 |
colors.red_gray = colors.Color(
|
|
|
|
| 53 |
c800="#732d2d", c900="#5f2626", c950="#4d2020",
|
| 54 |
)
|
| 55 |
|
| 56 |
+
class ThistleTheme(Soft):
|
| 57 |
def __init__(
|
| 58 |
self,
|
| 59 |
*,
|
| 60 |
primary_hue: colors.Color | str = colors.gray,
|
| 61 |
+
secondary_hue: colors.Color | str = colors.thistle, # 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="black",
|
| 85 |
button_primary_text_color_hover="white",
|
| 86 |
+
button_primary_background_fill="linear-gradient(90deg, *secondary_400, *secondary_500)",
|
| 87 |
+
button_primary_background_fill_hover="linear-gradient(90deg, *secondary_500, *secondary_600)",
|
| 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",
|
|
|
|
| 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_400",
|
| 97 |
slider_color_dark="*secondary_600",
|
| 98 |
block_title_text_weight="600",
|
| 99 |
block_border_width="3px",
|
|
|
|
| 105 |
)
|
| 106 |
|
| 107 |
# Instantiate the new theme
|
| 108 |
+
thistle_theme = ThistleTheme()
|
| 109 |
|
| 110 |
css = """
|
| 111 |
#main-title h1 {
|
|
|
|
| 377 |
time.sleep(0.01)
|
| 378 |
yield buffer, buffer
|
| 379 |
|
|
|
|
| 380 |
image_examples = [["Perform OCR on the image...", "examples/images/1.jpg"],
|
| 381 |
["Caption the image. Describe the safety measures shown in the image. Conclude whether the situation is (safe or unsafe)...", "examples/images/2.jpg"],
|
| 382 |
["Solve the problem...", "examples/images/3.png"]]
|
|
|
|
| 391 |
caption_examples = [["examples/captions/1.JPG"],
|
| 392 |
["examples/captions/2.jpeg"], ["examples/captions/3.jpeg"]]
|
| 393 |
|
| 394 |
+
with gr.Blocks(theme=thistle_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():
|