Update app.py
Browse files
app.py
CHANGED
|
@@ -50,7 +50,8 @@ class ThistleTheme(Soft):
|
|
| 50 |
primary_hue: colors.Color | str = colors.gray,
|
| 51 |
secondary_hue: colors.Color | str = colors.thistle,
|
| 52 |
neutral_hue: colors.Color | str = colors.slate,
|
| 53 |
-
|
|
|
|
| 54 |
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
| 55 |
fonts.GoogleFont("Inconsolata"), "Arial", "sans-serif",
|
| 56 |
),
|
|
@@ -106,12 +107,12 @@ thistle_theme = ThistleTheme()
|
|
| 106 |
|
| 107 |
# --- Custom CSS ---
|
| 108 |
css = """
|
| 109 |
-
/*
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
}
|
| 116 |
:root {
|
| 117 |
--color-grey-50: #f9fafb;
|
|
@@ -186,22 +187,15 @@ model_q3vl = Qwen3VLMoeForConditionalGeneration.from_pretrained(
|
|
| 186 |
# --- Backend Functions ---
|
| 187 |
|
| 188 |
def extract_gif_frames(gif_path: str):
|
| 189 |
-
"""
|
| 190 |
-
Extracts and downsamples frames from a GIF file.
|
| 191 |
-
"""
|
| 192 |
if not gif_path:
|
| 193 |
return []
|
| 194 |
-
|
| 195 |
with Image.open(gif_path) as gif:
|
| 196 |
total_frames = gif.n_frames
|
| 197 |
frame_indices = np.linspace(0, total_frames - 1, min(total_frames, 10), dtype=int)
|
| 198 |
-
|
| 199 |
frames = []
|
| 200 |
for i in frame_indices:
|
| 201 |
gif.seek(i)
|
| 202 |
-
# Convert frame to RGB and append a copy
|
| 203 |
frames.append(gif.convert("RGB").copy())
|
| 204 |
-
|
| 205 |
return frames
|
| 206 |
|
| 207 |
def downsample_video(video_path):
|
|
@@ -394,7 +388,8 @@ pdf_examples = [["examples/sample-doc.pdf"]]
|
|
| 394 |
|
| 395 |
with gr.Blocks(theme=thistle_theme, css=css) as demo:
|
| 396 |
pdf_state = gr.State(value=get_initial_pdf_state())
|
| 397 |
-
|
|
|
|
| 398 |
with gr.Row():
|
| 399 |
with gr.Column(scale=2):
|
| 400 |
with gr.Tabs():
|
|
@@ -440,7 +435,8 @@ with gr.Blocks(theme=thistle_theme, css=css) as demo:
|
|
| 440 |
repetition_penalty = gr.Slider(label="Repetition penalty", minimum=1.0, maximum=2.0, step=0.05, value=1.2)
|
| 441 |
|
| 442 |
with gr.Column(scale=3):
|
| 443 |
-
|
|
|
|
| 444 |
output = gr.Textbox(label="Raw Output Stream", interactive=False, lines=14, show_copy_button=True)
|
| 445 |
with gr.Accordion("(Result.md)", open=False):
|
| 446 |
markdown_output = gr.Markdown(label="(Result.Md)")
|
|
|
|
| 50 |
primary_hue: colors.Color | str = colors.gray,
|
| 51 |
secondary_hue: colors.Color | str = colors.thistle,
|
| 52 |
neutral_hue: colors.Color | str = colors.slate,
|
| 53 |
+
# Update: Increased base text size from md to lg
|
| 54 |
+
text_size: sizes.Size | str = sizes.text_lg,
|
| 55 |
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
| 56 |
fonts.GoogleFont("Inconsolata"), "Arial", "sans-serif",
|
| 57 |
),
|
|
|
|
| 107 |
|
| 108 |
# --- Custom CSS ---
|
| 109 |
css = """
|
| 110 |
+
/* Update: Added styles to increase the size of the main titles */
|
| 111 |
+
#main-title h1 {
|
| 112 |
+
font-size: 2.8em !important;
|
| 113 |
+
}
|
| 114 |
+
#output-title h2 {
|
| 115 |
+
font-size: 2.2em !important;
|
| 116 |
}
|
| 117 |
:root {
|
| 118 |
--color-grey-50: #f9fafb;
|
|
|
|
| 187 |
# --- Backend Functions ---
|
| 188 |
|
| 189 |
def extract_gif_frames(gif_path: str):
|
|
|
|
|
|
|
|
|
|
| 190 |
if not gif_path:
|
| 191 |
return []
|
|
|
|
| 192 |
with Image.open(gif_path) as gif:
|
| 193 |
total_frames = gif.n_frames
|
| 194 |
frame_indices = np.linspace(0, total_frames - 1, min(total_frames, 10), dtype=int)
|
|
|
|
| 195 |
frames = []
|
| 196 |
for i in frame_indices:
|
| 197 |
gif.seek(i)
|
|
|
|
| 198 |
frames.append(gif.convert("RGB").copy())
|
|
|
|
| 199 |
return frames
|
| 200 |
|
| 201 |
def downsample_video(video_path):
|
|
|
|
| 388 |
|
| 389 |
with gr.Blocks(theme=thistle_theme, css=css) as demo:
|
| 390 |
pdf_state = gr.State(value=get_initial_pdf_state())
|
| 391 |
+
# Update: Added elem_id for CSS targeting
|
| 392 |
+
gr.Markdown("# **Qwen3-VL-Demo**", elem_id="main-title")
|
| 393 |
with gr.Row():
|
| 394 |
with gr.Column(scale=2):
|
| 395 |
with gr.Tabs():
|
|
|
|
| 435 |
repetition_penalty = gr.Slider(label="Repetition penalty", minimum=1.0, maximum=2.0, step=0.05, value=1.2)
|
| 436 |
|
| 437 |
with gr.Column(scale=3):
|
| 438 |
+
# Update: Added elem_id for CSS targeting
|
| 439 |
+
gr.Markdown("## Output", elem_id="output-title")
|
| 440 |
output = gr.Textbox(label="Raw Output Stream", interactive=False, lines=14, show_copy_button=True)
|
| 441 |
with gr.Accordion("(Result.md)", open=False):
|
| 442 |
markdown_output = gr.Markdown(label="(Result.Md)")
|