Downloads · 30 days
13
8% of all-time downloads
BLR2/qwen2.5-vl-3b-ui-grounding
qwen2.5-vl-3b-ui-grounding is a image-text-to-text model from BLR2. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
This model is a fine-tuned version of Qwen/Qwen2.5-VL-3B-Instruct trained on the SeeClick dataset for predicting UI element coordinates.
Downloads · 30 days
13
8% of all-time downloads
All-time downloads
167
Public
Parameters
3.8B
7.5 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors7.5 GB · 100%
From the Hugging Face model README
This model is a fine-tuned version of Qwen/Qwen2.5-VL-3B-Instruct trained on the SeeClick dataset for predicting UI element coordinates.
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
from qwen_vl_utils import process_vision_info
from PIL import Image
import torch
model_name = "BLR2/qwen2.5-vl-3b-ui-grounding"
processor = AutoProcessor.from_pretrained(model_name)
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
model_name,
torch_dtype=torch.bfloat16,
device_map="auto",
)
image = Image.open("screenshot.png").convert("RGB")
messages = [
{
"role": "user",
"content": [
{"type": "image", "image": image},
{"type": "text", "text": "Given this UI screenshot, predict the center of: 'Submit button'."},
],
},
]
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
img, vid = process_vision_info(messages)
inputs = processor(text=[text], images=img, videos=None, padding=True, return_tensors="pt")
inputs = {k: v.to(model.device) for k, v in inputs.items()}
with torch.no_grad():
generated_ids = model.generate(**inputs, max_new_tokens=128, do_sample=False)
generated_ids_trimmed = generated_ids[0][len(inputs["input_ids"][0]):]
response = processor.decode(generated_ids_trimmed, skip_special_tokens=True)
print(response) # Output: "0.7532 0.8921" (x, y coordinates)
The model outputs normalized coordinates in the format x y where both values are in the range [0, 1]:
x: horizontal position (0 = left, 1 = right)y: vertical position (0 = top, 1 = bottom)