Download inference.py from Aevanis/Aevanis-Operator: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/Aevanis/Aevanis-Operator/resolve/main/inference.py
- Command line
-
hf download hf://Aevanis/Aevanis-Operator/inference.py
-
curl -L -o inference.py https://huggingface.co/Aevanis/Aevanis-Operator/resolve/main/inference.py
1.1 kB
| 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.") | |