Views
No views yet
1from transformers import Qwen3VLForConditionalGeneration, AutoProcessor
2from PIL import Image
3
4model = Qwen3VLForConditionalGeneration.from_pretrained("BLR2/qwen3-vl-4b-gui-agent-cropped", torch_dtype="auto", device_map="auto")
5processor = AutoProcessor.from_pretrained("BLR2/qwen3-vl-4b-gui-agent-cropped")
6
7image = Image.open("screenshot.png") # Should be cropped to 640x840
8instruction = "Click on the submit button"
9
10messages = [{
11 "role": "user",
12 "content": [
13 {"type": "image", "image": image},
14 {"type": "text", "text": instruction},
15 ],
16}]
17
18inputs = processor.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_dict=True, return_tensors="pt").to(model.device)
19outputs = model.generate(**inputs, max_new_tokens=50)
20response = processor.decode(outputs[0], skip_special_tokens=True)
21print(response) # "0.5234 0.7891"vllm serve BLR2/qwen3-vl-4b-gui-agent-cropped --dtype bfloat16x y where both are in [0, 1].px_x = int(x * image_width), px_y = int(y * image_height)