Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,20 +29,11 @@ from transformers.image_utils import load_image
|
|
| 29 |
from gradio.themes import Soft
|
| 30 |
from gradio.themes.utils import colors, fonts, sizes
|
| 31 |
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
c200="#C1D3E8",
|
| 38 |
-
c300="#A9C2DE",
|
| 39 |
-
c400="#7A9ECB",
|
| 40 |
-
c500="#4682B4", # Steel Blue
|
| 41 |
-
c600="#3D719E",
|
| 42 |
-
c700="#346088",
|
| 43 |
-
c800="#2B4F71",
|
| 44 |
-
c900="#223E5B",
|
| 45 |
-
c950="#1A2D45",
|
| 46 |
)
|
| 47 |
|
| 48 |
colors.red_gray = colors.Color(
|
|
@@ -52,12 +43,12 @@ colors.red_gray = colors.Color(
|
|
| 52 |
c800="#732d2d", c900="#5f2626", c950="#4d2020",
|
| 53 |
)
|
| 54 |
|
| 55 |
-
class
|
| 56 |
def __init__(
|
| 57 |
self,
|
| 58 |
*,
|
| 59 |
primary_hue: colors.Color | str = colors.gray,
|
| 60 |
-
secondary_hue: colors.Color | str = colors.
|
| 61 |
neutral_hue: colors.Color | str = colors.slate,
|
| 62 |
text_size: sizes.Size | str = sizes.text_md,
|
| 63 |
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
|
@@ -82,8 +73,8 @@ class SteelBlueTheme(Soft):
|
|
| 82 |
body_background_fill_dark="linear-gradient(135deg, *primary_900, *primary_800)",
|
| 83 |
button_primary_text_color="white",
|
| 84 |
button_primary_text_color_hover="black",
|
| 85 |
-
button_primary_background_fill="linear-gradient(90deg, *
|
| 86 |
-
button_primary_background_fill_hover="linear-gradient(90deg, *
|
| 87 |
button_primary_background_fill_dark="linear-gradient(90deg, *secondary_600, *secondary_800)",
|
| 88 |
button_primary_background_fill_hover_dark="linear-gradient(90deg, *secondary_500, *secondary_500)",
|
| 89 |
button_secondary_text_color="black",
|
|
@@ -100,7 +91,7 @@ class SteelBlueTheme(Soft):
|
|
| 100 |
button_cancel_text_color_dark="white",
|
| 101 |
button_cancel_text_color_hover="white",
|
| 102 |
button_cancel_text_color_hover_dark="white",
|
| 103 |
-
slider_color="*
|
| 104 |
slider_color_dark="*secondary_600",
|
| 105 |
block_title_text_weight="600",
|
| 106 |
block_border_width="3px",
|
|
@@ -111,16 +102,10 @@ class SteelBlueTheme(Soft):
|
|
| 111 |
block_label_background_fill="*primary_200",
|
| 112 |
)
|
| 113 |
|
| 114 |
-
|
| 115 |
|
| 116 |
# --- Custom CSS ---
|
| 117 |
css = """
|
| 118 |
-
/* Add a slight zoom to the entire UI */
|
| 119 |
-
.gradio-container {
|
| 120 |
-
transform: scale(1.03);
|
| 121 |
-
transform-origin: top center;
|
| 122 |
-
margin-top: 20px; /* Add some margin to prevent top cutoff */
|
| 123 |
-
}
|
| 124 |
:root {
|
| 125 |
--color-grey-50: #f9fafb;
|
| 126 |
--banner-background: var(--secondary-400);
|
|
@@ -328,7 +313,7 @@ image_examples = [["Describe the safety measures in the image. Conclude (Safe /
|
|
| 328 |
video_examples = [["Explain the video in detail.", "videos/2.mp4"]]
|
| 329 |
pdf_examples = [["examples/sample-doc.pdf"]]
|
| 330 |
|
| 331 |
-
with gr.Blocks(theme=
|
| 332 |
pdf_state = gr.State(value=get_initial_pdf_state())
|
| 333 |
gr.Markdown("# **Qwen3-VL-Processor**")
|
| 334 |
with gr.Row():
|
|
@@ -372,7 +357,6 @@ with gr.Blocks(theme=steel_blue_theme, css=css) as demo:
|
|
| 372 |
with gr.Accordion("(Result.md)", open=False):
|
| 373 |
markdown_output = gr.Markdown(label="(Result.Md)")
|
| 374 |
|
| 375 |
-
# Event handlers
|
| 376 |
# Event handlers
|
| 377 |
image_submit.click(
|
| 378 |
fn=generate_image,
|
|
|
|
| 29 |
from gradio.themes import Soft
|
| 30 |
from gradio.themes.utils import colors, fonts, sizes
|
| 31 |
|
| 32 |
+
colors.teal_gray = colors.Color(
|
| 33 |
+
name="teal_gray",
|
| 34 |
+
c50="#e8f1f4", c100="#cddde3", c200="#a8c3cf", c300="#7da6b8",
|
| 35 |
+
c400="#588aa2", c500="#3d6e87", c600="#335b70", c700="#2b495a",
|
| 36 |
+
c800="#2c5364", c900="#233f4b", c950="#1b323c",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
)
|
| 38 |
|
| 39 |
colors.red_gray = colors.Color(
|
|
|
|
| 43 |
c800="#732d2d", c900="#5f2626", c950="#4d2020",
|
| 44 |
)
|
| 45 |
|
| 46 |
+
class Teals(Soft):
|
| 47 |
def __init__(
|
| 48 |
self,
|
| 49 |
*,
|
| 50 |
primary_hue: colors.Color | str = colors.gray,
|
| 51 |
+
secondary_hue: colors.Color | str = colors.teal_gray,
|
| 52 |
neutral_hue: colors.Color | str = colors.slate,
|
| 53 |
text_size: sizes.Size | str = sizes.text_md,
|
| 54 |
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
|
|
|
| 73 |
body_background_fill_dark="linear-gradient(135deg, *primary_900, *primary_800)",
|
| 74 |
button_primary_text_color="white",
|
| 75 |
button_primary_text_color_hover="black",
|
| 76 |
+
button_primary_background_fill="linear-gradient(90deg, *secondary_400, *secondary_400)",
|
| 77 |
+
button_primary_background_fill_hover="linear-gradient(90deg, *secondary_300, *secondary_300)",
|
| 78 |
button_primary_background_fill_dark="linear-gradient(90deg, *secondary_600, *secondary_800)",
|
| 79 |
button_primary_background_fill_hover_dark="linear-gradient(90deg, *secondary_500, *secondary_500)",
|
| 80 |
button_secondary_text_color="black",
|
|
|
|
| 91 |
button_cancel_text_color_dark="white",
|
| 92 |
button_cancel_text_color_hover="white",
|
| 93 |
button_cancel_text_color_hover_dark="white",
|
| 94 |
+
slider_color="*secondary_300",
|
| 95 |
slider_color_dark="*secondary_600",
|
| 96 |
block_title_text_weight="600",
|
| 97 |
block_border_width="3px",
|
|
|
|
| 102 |
block_label_background_fill="*primary_200",
|
| 103 |
)
|
| 104 |
|
| 105 |
+
teals = Teals()
|
| 106 |
|
| 107 |
# --- Custom CSS ---
|
| 108 |
css = """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
:root {
|
| 110 |
--color-grey-50: #f9fafb;
|
| 111 |
--banner-background: var(--secondary-400);
|
|
|
|
| 313 |
video_examples = [["Explain the video in detail.", "videos/2.mp4"]]
|
| 314 |
pdf_examples = [["examples/sample-doc.pdf"]]
|
| 315 |
|
| 316 |
+
with gr.Blocks(theme=teals, css=css) as demo:
|
| 317 |
pdf_state = gr.State(value=get_initial_pdf_state())
|
| 318 |
gr.Markdown("# **Qwen3-VL-Processor**")
|
| 319 |
with gr.Row():
|
|
|
|
| 357 |
with gr.Accordion("(Result.md)", open=False):
|
| 358 |
markdown_output = gr.Markdown(label="(Result.Md)")
|
| 359 |
|
|
|
|
| 360 |
# Event handlers
|
| 361 |
image_submit.click(
|
| 362 |
fn=generate_image,
|