Spaces:
Running
on
Zero
Running
on
Zero
update app
Browse files
app.py
CHANGED
|
@@ -136,6 +136,15 @@ model_y = Qwen3VLForConditionalGeneration.from_pretrained(
|
|
| 136 |
torch_dtype=torch.float16
|
| 137 |
).to(device).eval()
|
| 138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
def downsample_video(video_path):
|
| 140 |
"""
|
| 141 |
Downsamples the video to evenly spaced frames.
|
|
@@ -176,6 +185,8 @@ def generate_image(model_name: str, text: str, image: Image.Image,
|
|
| 176 |
processor, model = processor_q, model_q
|
| 177 |
elif model_name == "Qwen3-VL-8B-Instruct":
|
| 178 |
processor, model = processor_y, model_y
|
|
|
|
|
|
|
| 179 |
else:
|
| 180 |
yield "Invalid model selected.", "Invalid model selected."
|
| 181 |
return
|
|
@@ -219,6 +230,8 @@ def generate_video(model_name: str, text: str, video_path: str,
|
|
| 219 |
processor, model = processor_q, model_q
|
| 220 |
elif model_name == "Qwen3-VL-8B-Instruct":
|
| 221 |
processor, model = processor_y, model_y
|
|
|
|
|
|
|
| 222 |
else:
|
| 223 |
yield "Invalid model selected.", "Invalid model selected."
|
| 224 |
return
|
|
@@ -315,7 +328,7 @@ with gr.Blocks(css=css, theme=steel_blue_theme) as demo:
|
|
| 315 |
markdown_output = gr.Markdown()
|
| 316 |
|
| 317 |
model_choice = gr.Radio(
|
| 318 |
-
choices=["Qwen3-VL-4B-Instruct", "Qwen3-VL-8B-Instruct", "Qwen2.5-VL-3B-Instruct", "Qwen2.5-VL-7B-Instruct"],
|
| 319 |
label="Select Model",
|
| 320 |
value="Qwen3-VL-4B-Instruct"
|
| 321 |
)
|
|
|
|
| 136 |
torch_dtype=torch.float16
|
| 137 |
).to(device).eval()
|
| 138 |
|
| 139 |
+
# Load Qwen3-VL-4B-Thinking
|
| 140 |
+
MODEL_ID_T = "Qwen/Qwen3-VL-4B-Thinking"
|
| 141 |
+
processor_t = AutoProcessor.from_pretrained(MODEL_ID_T, trust_remote_code=True)
|
| 142 |
+
model_t = Qwen3VLForConditionalGeneration.from_pretrained(
|
| 143 |
+
MODEL_ID_T,
|
| 144 |
+
trust_remote_code=True,
|
| 145 |
+
torch_dtype=torch.float16
|
| 146 |
+
).to(device).eval()
|
| 147 |
+
|
| 148 |
def downsample_video(video_path):
|
| 149 |
"""
|
| 150 |
Downsamples the video to evenly spaced frames.
|
|
|
|
| 185 |
processor, model = processor_q, model_q
|
| 186 |
elif model_name == "Qwen3-VL-8B-Instruct":
|
| 187 |
processor, model = processor_y, model_y
|
| 188 |
+
elif model_name == "Qwen3-VL-4B-Thinking":
|
| 189 |
+
processor, model = processor_t, model_t
|
| 190 |
else:
|
| 191 |
yield "Invalid model selected.", "Invalid model selected."
|
| 192 |
return
|
|
|
|
| 230 |
processor, model = processor_q, model_q
|
| 231 |
elif model_name == "Qwen3-VL-8B-Instruct":
|
| 232 |
processor, model = processor_y, model_y
|
| 233 |
+
elif model_name == "Qwen3-VL-4B-Thinking":
|
| 234 |
+
processor, model = processor_t, model_t
|
| 235 |
else:
|
| 236 |
yield "Invalid model selected.", "Invalid model selected."
|
| 237 |
return
|
|
|
|
| 328 |
markdown_output = gr.Markdown()
|
| 329 |
|
| 330 |
model_choice = gr.Radio(
|
| 331 |
+
choices=["Qwen3-VL-4B-Instruct", "Qwen3-VL-8B-Instruct", "Qwen3-VL-4B-Thinking", "Qwen2.5-VL-3B-Instruct", "Qwen2.5-VL-7B-Instruct"],
|
| 332 |
label="Select Model",
|
| 333 |
value="Qwen3-VL-4B-Instruct"
|
| 334 |
)
|