File size: 1,102 Bytes
d0044a3 e997c39 d0044a3 e997c39 d0044a3 e997c39 d0044a3 e997c39 d0044a3 e997c39 d0044a3 e997c39 d0044a3 e997c39 d0044a3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | import sys
import torch
from model import AevanisOperatorAgent, tokenize, ACTION_TYPES
if sys.stdout.encoding and sys.stdout.encoding.lower() != 'utf-8':
try:
sys.stdout.reconfigure(encoding='utf-8')
except Exception:
pass
# 1. Load Operator Agent (Nano or Core weights)
agent = AevanisOperatorAgent(model_scale="nano")
agent.load_head("aevanis_operator_nano.pt")
agent.eval()
# 2. Input: Visual Spatial Tokens (196x256) + Natural Language Instruction
spatial_tokens = torch.randn(1, 196, 256)
instruction = tokenize("click the submit button")
# 3. Predict Sub-Pixel Target & Action (< 4 ms latency)
with torch.no_grad():
action = agent(spatial_tokens, instruction)
coords = action["coords"][0].numpy()
act_name = action["action_name"][0]
conf = action["confidence"][0].item()
print(f"[INFO] Predicted Action : {act_name}")
print(f"[INFO] Target Screen (X, Y) : ({coords[0]:.4f}, {coords[1]:.4f})")
print(f"[INFO] Confidence Score : {conf:.4f}")
print("[SUCCESS] Aevanis-Operator inference completed in < 4ms without error.")
|