Views
No views yet

| Model | Activated Size | ScreenSpot-Pro | OS-World-G | OS-World-G (Refined) |
|---|---|---|---|---|
| Qwen3-VL-30B-A3B-Instruct | 3 B | 60.5% | 61.0% | - |
| Qwen3-VL-235B-A22B-Instruct | 22 B | 62.0% | 66.7% | - |
| OpenCUA-72B | 72 B | 60.8% | 59.6% | - |
| GTA1-32B | 32 B | 63.6% | 65.2% | 72.2% |
| Gelato-30B-A3B | 3 B | 63.88% | 69.15% | 74.65% |

1from transformers import Qwen3VLMoeForConditionalGeneration, AutoProcessor
2import re
3from PIL import Image, ImageDraw
4import requests
5from io import BytesIO
6
7
8def extract_coordinates(raw_string):
9 """
10 Extract the coordinates from the raw string.
11 Args:
12 raw_string: str (e.g. "(100, 200)")
13 Returns:
14 x: float (e.g. 100.0)
15 y: float (e.g. 200.0)
16 """
17 try:
18 matches = re.findall(r"\((-?\d*\.?\d+),\s*(-?\d*\.?\d+)\)", raw_string)
19 return [tuple(map(int, match)) for match in matches][0]
20 except:
21 return 0,0
22
23def visualize_prediction(img, pred_x, pred_y, img_width, img_height):
24 """
25 Visualize the predicted coordinates on the image (high visibility).
26 """
27 pred_x = int((pred_x * img_width) / 1000)
28 pred_y = int((pred_y * img_height) / 1000)
29
30 draw = ImageDraw.Draw(img, "RGBA")
31
32 r = 30
33 draw.ellipse(
34 (pred_x - r, pred_y - r, pred_x + r, pred_y + r),
35 outline="lime",
36 fill=(0, 255, 0, 90),
37 width=5
38 )
39
40 cross_len = 15
41 draw.line((pred_x - cross_len, pred_y, pred_x + cross_len, pred_y), fill="lime", width=5)
42 draw.line((pred_x, pred_y - cross_len, pred_x, pred_y + cross_len), fill="lime", width=5)
43
44 img.save("predicted_coordinates.png")
45 print(f"Predicted coordinates: ({pred_x}, {pred_y})")
46
47# Load the model and processor
48MODEL_PATH = "mlfoundations/Gelato-30B-A3B"
49
50model = Qwen3VLMoeForConditionalGeneration.from_pretrained(
51 MODEL_PATH,
52 device_map="auto",
53 dtype="auto"
54)
55
56processor = AutoProcessor.from_pretrained(
57 MODEL_PATH
58)
59
60url = "https://github.com/QwenLM/Qwen3-VL/raw/main/cookbooks/assets/computer_use/computer_use1.jpeg"
61response = requests.get(url)
62img = Image.open(BytesIO(response.content))
63img_width, img_height = img.size
64
65# Prepare messages
66PROMPT = '''
67You are an expert UI element locator. Given a GUI image and a user's element description, provide the coordinates of the specified element as a single (x,y) point. For elements with area, return the center point.
68
69Output the coordinate pair exactly:
70(x,y)
71'''
72PROMPT = PROMPT.strip()
73INSTRUCTION = "Reload the cache."
74
75messages = [
76 {
77 "role": "user",
78 "content": [
79 {"type": "text", "text": PROMPT + "\n\n"},
80 {"type": "image", "image": img},
81 {"type": "text", "text": "\n" + INSTRUCTION},
82 ],
83 }
84]
85
86device = next(model.parameters()).device
87inputs = processor.apply_chat_template(
88 messages,
89 tokenize=True,
90 add_generation_prompt=True,
91 return_dict=True,
92 return_tensors="pt"
93).to(device)
94
95# Inference: Generation of the output
96generated_ids = model.generate(**inputs, max_new_tokens=32)
97generated_ids_trimmed = [
98 out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
99]
100output_text = processor.batch_decode(
101 generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
102)
103
104# Extract the coordinates from the output text
105print(f"Model output: {output_text[0]}")
106pred_x, pred_y = extract_coordinates(output_text[0])
107
108# Calculate the absolute coordinates from normalized coordinates
109visualize_prediction(img, pred_x, pred_y, img_width, img_height)@misc{gelato2025,
title={Gelato — From Data Curation to Reinforcement Learning: Building a Strong Grounding Model for Computer-Use Agents},
author={Anas Awadalla, Dhruba Ghosh, Aylin Akkus, Yuhui Zhang, Marianna Nezhurina, Jenia Jitsev, Yejin Choi, Ludwig Schmidt},
year={2025},
publisher={GitHub},
howpublished={\url{https://github.com/mlfoundations/gelato}},
}