Views
No views yet
1from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
2import torch, PIL.Image as Image
3
4model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
5 "macpaw-research/GUIrilla-See-7B",
6 torch_dtype="auto",
7 device_map="auto",
8 attn_implementation="flash_attention_2",
9 trust_remote_code=True,
10)
11processor = AutoProcessor.from_pretrained(
12 "macpaw-research/GUIrilla-See-7B",
13 trust_remote_code=True,
14 use_fast=True,
15)
16
17image = Image.open("screenshot.png")
18task = "the search field in the top-right corner"
19
20conversation = [{
21 "role": "user",
22 "content": [
23 {"type": "image", "image": image},
24 {"type": "text",
25 "text": (
26 "Your task is to help the user identify the precise coordinates "
27 "(x, y) of a specific area/element/object on the screen based on "
28 "a description.\n"
29 "- Your response should aim to point to the centre or a representative "
30 "point within the described area/element/object as accurately as possible.\n"
31 "- If the description is unclear or ambiguous, infer the most relevant area "
32 "or element based on its likely context or purpose.\n"
33 "- Your answer should be a single string (x, y) corresponding to the point "
34 "of interest.\n"
35 f"\nDescription: {task}"
36 "\nAnswer:"
37 )},
38 ],
39}]
40
41texts = processor.apply_chat_template(conversation, tokenize=False,
42 add_generation_prompt=True)
43image_inputs = [image]
44inputs = processor(text=texts, images=image_inputs,
45 return_tensors="pt", padding=True).to(model.device)
46
47with torch.no_grad():
48 output_ids = model.generate(**inputs, max_new_tokens=16, num_beams=3)
49
50generated_ids = output_ids[:, inputs.input_ids.shape[1]:]
51answer = processor.batch_decode(generated_ids,
52 skip_special_tokens=True)[0]
53print("Predicted click:", answer) # → "(812, 115)"| Split | Success Rate % |
|---|---|
| Test | 75.59 |
LICENSE).@article{garkot2025guirilla,
title={GUIrilla: A Scalable Framework for Automated Desktop UI Exploration},
author={Garkot, Sofiya and Shamrai, Maksym and Synytsia, Ivan and Hirna, Mariya},
journal={arXiv preprint arXiv:2510.16051},
year={2025},
url={https://arxiv.org/abs/2510.16051}
}