"""Pick the next element on a live page with the released model. Needs: a GPU, torch, transformers (Gemma 4 support), peft, playwright (`playwright install chromium`), lxml, scikit-learn, pillow. The pointer and the confidence come from the model; typing the value and clicking is done by Playwright below. Do not use the confidence to trigger irreversible actions: it is not calibrated, see the model card. """ import sys sys.path.insert(0, "code") from playwright.sync_api import sync_playwright from m2w_form_demo import Gemma, aday_listesi, softmax REPO = "senpaicq/m2w-gemma4-e2b-pointer" URL = "https://example.com" TASK = "Open the more information page" HISTORY = [] # previous actions in the style "[link] Flights -> CLICK" or "[textbox] Where from? -> TYPE: LAX" model = Gemma(REPO, shots_dir="tmp_shots") with sync_playwright() as pw: browser = pw.chromium.launch(headless=True, args=["--no-sandbox"]) page = browser.new_page(viewport={"width": 1280, "height": 720}) page.goto(URL) cands, raw = aday_listesi(page, TASK, HISTORY, arm="etiketli") # "etiketli": bound