import torch
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
repo_id = "drunksu/GUISwiper"
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
repo_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
processor = AutoProcessor.from_pretrained(repo_id)
image = load_your_gui_screenshot()
messages = [{"role": "user", "content": [
{"type": "image", "image": image},
{"type": "text", "text": "Describe the swipe to perform here."},
]}]
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = processor(text=[text], images=[image], return_tensors="pt").to(model.device)
output = model.generate(**inputs, max_new_tokens=256)
print(processor.batch_decode(output, skip_special_tokens=True)[0])