from transformers import AutoModelForImageTextToText, AutoProcessorfrom PIL import Image model = AutoModelForImageTextToText.from_pretrained( "insagur/qwen3.5-9b-agentnet-ubuntu-1epoch", torch_dtype="bfloat16",).to("cuda")processor = AutoProcessor.from_pretrained("insagur/qwen3.5-9b-agentnet-ubuntu-1epoch") system = ( "You are a computer-use agent operating a Linux desktop. " "You receive the user's task and the current screenshot. " "Respond with your reasoning, the action description, and the pyautogui code to execute. " "All coordinates are normalized to [0, 1] of screen width/height. " "Format your response exactly as:\n" "Thought: <your reasoning>\nAction: <one-sentence description of the next action>\nCode:\n<pyautogui code>")image = Image.open("screenshot.png").convert("RGB")messages = [ {"role": "system", "content": system}, {"role": "user", "content": [ {"type": "image", "image": image}, {"type": "text", "text": "Task: Open the terminal.\n<image>\nWhat is the next action?"}, ]},]text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)inputs = processor(text=[text], images=[image], return_tensors="pt").to("cuda")out = model.generate(**inputs, max_new_tokens=256)print(processor.batch_decode(out, skip_special_tokens=True)[0])