PEFT
Safetensors
English
web-agents
gui-agents
mind2web
lora
pointer-network
selective-prediction
calibration
decision-making
fast-decision-model
system-1
model-routing
gui-grounding
Instructions to use senpaicq/m2w-gemma4-e2b-pointer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use senpaicq/m2w-gemma4-e2b-pointer with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
Download code/m2w_form_sayfalari.py from senpaicq/m2w-gemma4-e2b-pointer: direct link, hf CLI and curl.
- Browser
- Download file 15.4 kB
-
https://huggingface.co/senpaicq/m2w-gemma4-e2b-pointer/resolve/main/code/m2w_form_sayfalari.py
- Command line
-
hf download hf://senpaicq/m2w-gemma4-e2b-pointer/code/m2w_form_sayfalari.py
-
curl -L -o m2w_form_sayfalari.py https://huggingface.co/senpaicq/m2w-gemma4-e2b-pointer/resolve/main/code/m2w_form_sayfalari.py
15.4 kB
| #!/usr/bin/env python3 | |
| """Form demosu için test sayfaları. | |
| 1) SENTETİK sayfalar (make_forms): 12 form, farklı etiket stilleri, gürültü (menü, arama kutusu, altbilgi, bülten kutusu). | |
| Gemma bu sayfaları hiç görmedi ama Mind2Web'in gerçek sitelerinden daha temiz oldukları için sonuç iyimser olabilir. | |
| 2) GERÇEK pratik siteler (REMOTE): internet varsa denenir, erişilemezse atlanır. Hiçbirinde "gönder" tuşuna basılmaz. | |
| Alan tanımı (spec["fields"][i]): | |
| kind : text | textarea | select | checkbox | radio | |
| label : insanın gördüğü etiket (görev cümlesinde geçer) | |
| value : yazılacak metin / seçilecek seçenek / (checkbox, radio için) boş | |
| css : hedef elemanı bulan seçici (YALNIZCA doğruluk ölçmek için; modele verilmez) | |
| """ | |
| import html | |
| import os | |
| import random | |
| NAV = ["Home", "Products", "Pricing", "About", "Blog", "Support", "Careers", "Contact", "Help", "Cart", "Login", "Stores"] | |
| FOOT = ["Privacy", "Terms", "Press", "Partners", "Sitemap", "Accessibility", "Investors", "Status", "Security", "Cookies"] | |
| LOREM = ("Please fill in the details below. Fields marked with a star are required. We usually reply within two business days, " | |
| "and you can edit your answers before the final confirmation. Our team never shares your information with third parties.") | |
| FIRST = ["Ali", "Maria", "John", "Elif", "Chen"] | |
| LAST = ["Yilmaz", "Garcia", "Smith", "Demir", "Wang"] | |
| # (kind, label, value, extra) extra: select için seçenekler, radio için grup adı | |
| FORMS = [ | |
| ("contact", "Contact us", "for", 1, [ | |
| ("text", "Full name", "Ali Yilmaz", None), ("text", "Email address", "ali.yilmaz@example.com", None), | |
| ("select", "Subject", "Billing question", ["General question", "Billing question", "Technical problem", "Partnership"]), | |
| ("textarea", "Message", "I would like to update my invoice address.", None)]), | |
| ("signup", "Create your account", "wrap", 1, [ | |
| ("text", "Username", "alyilmaz84", None), ("text", "Email", "ali.yilmaz@example.com", None), | |
| ("text", "Password", "Sup3rSecret!", None), | |
| ("select", "Country", "Turkey", ["United States", "Germany", "Turkey", "Japan", "Brazil"]), | |
| ("checkbox", "I agree to the terms of service", "", None)]), | |
| ("shipping", "Shipping address", "ph", 1, [ | |
| ("text", "Full name", "Maria Garcia", None), ("text", "Street address", "42 Oak Avenue", None), | |
| ("text", "City", "Madrid", None), | |
| ("select", "State", "Texas", ["California", "Texas", "New York", "Florida", "Ohio"]), | |
| ("text", "ZIP code", "73301", None), ("text", "Phone number", "555 0134", None)]), | |
| ("hotel", "Book your stay", "for", 2, [ | |
| ("text", "Destination", "Lisbon", None), ("text", "Check-in date", "11/03/2026", None), | |
| ("text", "Check-out date", "11/07/2026", None), | |
| ("select", "Guests", "2 guests", ["1 guest", "2 guests", "3 guests", "4 guests"]), | |
| ("radio", "Deluxe", "", "Room type"), ("checkbox", "Include breakfast", "", None)]), | |
| ("job", "Job application", "div", 1, [ | |
| ("text", "First name", "John", None), ("text", "Last name", "Smith", None), | |
| ("text", "Email", "john.smith@example.com", None), ("text", "Phone", "555 0178", None), | |
| ("select", "Position", "Data analyst", ["Software engineer", "Data analyst", "Designer", "Product manager"]), | |
| ("textarea", "Cover letter", "I have five years of experience in analytics.", None)]), | |
| ("newsletter", "Subscribe to our newsletter", "aria", 1, [ | |
| ("text", "Email", "elif.demir@example.com", None), ("checkbox", "Technology", "", None), | |
| ("checkbox", "Travel", "", None), ("radio", "Weekly", "", "Frequency")]), | |
| ("support", "Open a support ticket", "mixed", 1, [ | |
| ("text", "Your name", "Elif Demir", None), ("text", "Email", "elif.demir@example.com", None), | |
| ("text", "Order number", "A-20931", None), | |
| ("select", "Issue type", "Late delivery", ["Damaged item", "Late delivery", "Wrong item", "Refund"]), | |
| ("radio", "High", "", "Priority"), ("textarea", "Describe the problem", "The package has not arrived after ten days.", None)]), | |
| ("rental", "Rent a car", "wrap", 2, [ | |
| ("text", "Pick-up location", "Berlin Airport", None), ("text", "Drop-off location", "Munich Central", None), | |
| ("text", "Pick-up date", "12/01/2026", None), | |
| ("select", "Car type", "SUV", ["Economy", "Compact", "SUV", "Van"]), | |
| ("text", "Driver age", "34", None), ("checkbox", "Add full insurance", "", None)]), | |
| ("event", "Register for the conference", "ph", 1, [ | |
| ("text", "Full name", "Chen Wang", None), ("text", "Work email", "chen.wang@example.com", None), | |
| ("text", "Company", "Northwind Labs", None), ("radio", "Student ticket", "", "Ticket type"), | |
| ("select", "Dietary needs", "Vegetarian", ["None", "Vegetarian", "Vegan", "Gluten free"]), | |
| ("select", "T-shirt size", "M", ["S", "M", "L", "XL"])]), | |
| ("donate", "Make a donation", "for", 2, [ | |
| ("text", "Amount", "50", None), ("text", "First name", "Maria", None), ("text", "Last name", "Garcia", None), | |
| ("text", "Email", "maria.garcia@example.com", None), ("radio", "Monthly", "", "Frequency"), | |
| ("checkbox", "Donate anonymously", "", None)]), | |
| ("clinic", "Book an appointment", "div", 1, [ | |
| ("text", "Patient name", "John Smith", None), ("text", "Phone number", "555 0102", None), | |
| ("select", "Doctor", "Dr. Park", ["Dr. Adams", "Dr. Park", "Dr. Rossi", "Dr. Kaya"]), | |
| ("text", "Preferred date", "11/15/2026", None), | |
| ("select", "Time", "10:30", ["09:00", "10:30", "13:00", "15:30"]), | |
| ("textarea", "Reason for visit", "Annual check-up.", None)]), | |
| ("survey", "Customer survey", "mixed", 1, [ | |
| ("radio", "25-34", "", "Age group"), | |
| ("select", "Satisfaction", "Very satisfied", ["Very dissatisfied", "Neutral", "Satisfied", "Very satisfied"]), | |
| ("textarea", "Other feedback", "Delivery was fast and the support was friendly.", None), | |
| ("text", "Email (optional)", "ali.yilmaz@example.com", None), ("checkbox", "I would recommend you to a friend", "", None)]), | |
| ] | |
| ROLE_OF_KIND = {"text": "textbox", "textarea": "textbox", "select": "combobox", "checkbox": "checkbox", "radio": "radio"} | |
| OP_OF_KIND = {"text": "TYPE", "textarea": "TYPE", "select": "SELECT", "checkbox": "CLICK", "radio": "CLICK"} | |
| CSS = """body{font-family:Arial,Helvetica,sans-serif;margin:0;color:#222;background:#f6f7f9} | |
| nav{background:#1f2a44;padding:14px 24px;display:flex;gap:18px;align-items:center;flex-wrap:wrap} | |
| nav a{color:#fff;text-decoration:none;font-size:14px}nav .logo{font-weight:bold;font-size:18px;margin-right:18px;color:#fff} | |
| nav input{padding:6px;border-radius:4px;border:1px solid #889}nav button{padding:6px 10px} | |
| main{max-width:760px;margin:24px auto;background:#fff;padding:28px;border-radius:8px} | |
| h1{font-size:26px;margin-top:0}.grid{display:grid;gap:14px}.g2{grid-template-columns:1fr 1fr} | |
| .row{display:flex;flex-direction:column;gap:5px;font-size:14px}.wide{grid-column:1/-1} | |
| input[type=text],select,textarea{padding:9px;border:1px solid #aab;border-radius:5px;font-size:14px} | |
| .opt{display:flex;gap:6px;align-items:center;font-size:14px}.lbl{font-weight:bold}.help{font-size:13px;color:#555} | |
| .btns{display:flex;gap:10px;margin-top:18px}.btns button{padding:10px 18px;border-radius:5px;border:0;background:#2f6fed;color:#fff;font-size:15px} | |
| .btns .sec{background:#ccd}footer{max-width:760px;margin:16px auto;padding:18px;font-size:13px;color:#445} | |
| footer a{margin-right:12px;color:#445}.promo{background:#fff4d6;padding:10px;border-radius:5px;margin-bottom:14px;font-size:14px}""" | |
| def _attr(**kw): | |
| return " ".join(f'{k.replace("_", "-")}="{html.escape(str(v), quote=True)}"' for k, v in kw.items() if v is not None) | |
| def _control(f, style, fid, rnd): | |
| """(html, stil) -- tek bir alanın satırı.""" | |
| kind, label, opts = f["kind"], f["label"], f.get("opts") | |
| lab = html.escape(label) | |
| if style == "mixed": | |
| style = rnd.choice(["for", "wrap", "ph", "div", "aria"]) | |
| name = rnd.choice([fid, label.lower().replace(" ", "_")[:20], "fld" + fid[-1]]) | |
| if kind in ("checkbox", "radio"): | |
| grp = f.get("group") | |
| nm = (grp or label).lower().replace(" ", "_")[:20] if kind == "radio" else name | |
| h = f'<label class="opt"><input type="{kind}" id="{fid}" name="{html.escape(nm)}"> {lab}</label>' | |
| return h, "for" | |
| if kind == "select": | |
| os_ = "".join(f"<option>{html.escape(o)}</option>" for o in opts) | |
| first = f'<option value="">{lab}</option>' if style == "ph" else '<option value="">Select…</option>' | |
| tag = f'<select id="{fid}" name="{html.escape(name)}" {_attr(aria_label=label if style == "aria" else None)}>{first}{os_}</select>' | |
| elif kind == "textarea": | |
| tag = f'<textarea id="{fid}" name="{html.escape(name)}" rows="4" {_attr(placeholder=label if style == "ph" else None, aria_label=label if style == "aria" else None)}></textarea>' | |
| else: | |
| tag = f'<input type="text" id="{fid}" name="{html.escape(name)}" {_attr(placeholder=label if style == "ph" else None, aria_label=label if style == "aria" else None)}>' | |
| if style == "for": | |
| h = f'<div class="row"><label for="{fid}" class="lbl">{lab}</label>{tag}</div>' | |
| elif style == "wrap": | |
| h = f'<label class="row"><span class="lbl">{lab}</span>{tag}</label>' | |
| elif style == "div": | |
| h = f'<div class="row"><div class="lbl">{lab}</div>{tag}</div>' | |
| else: # ph, aria: görünür etiket yok (placeholder görünür, aria-label değil) | |
| h = f'<div class="row">{tag}</div>' | |
| return h, style | |
| def render(slug, title, style, cols, fields, seed): | |
| rnd = random.Random(seed) | |
| nav = rnd.sample(NAV, rnd.randint(6, 9)) | |
| foot = rnd.sample(FOOT, rnd.randint(5, 8)) | |
| pre = "".join(f"<p class='help'>{LOREM}</p>" for _ in range(rnd.choice([0, 1, 2, 5 if seed % 5 == 0 else 1]))) | |
| rows, groups_done = [], set() | |
| for i, f in enumerate(fields): | |
| fid = f"f{i + 1}x{seed % 97}" | |
| f["id"] = fid; f["css"] = "#" + fid | |
| h, st = _control(f, style, fid, rnd) | |
| f["stil"] = st | |
| wide = f["kind"] in ("textarea", "radio", "checkbox") and cols == 2 | |
| g = f.get("group") | |
| if g and g not in groups_done: | |
| rows.append(f'<div class="wide lbl">{html.escape(g)}</div>'); groups_done.add(g) | |
| rows.append(f'<div class="{"wide" if wide else ""}">{h}</div>') | |
| decoy = ('<div class="promo">Get 10% off your first order! <input type="text" placeholder="Your email for offers"> ' | |
| '<button type="button">Subscribe</button></div>') if seed % 2 == 0 else "" | |
| page = f"""<!doctype html><html lang="en"><head><meta charset="utf-8"><title>{html.escape(title)}</title><style>{CSS}</style></head><body> | |
| <nav><span class="logo">Northgate</span>{''.join(f'<a href="#{n.lower()}">{n}</a>' for n in nav)} | |
| <input type="text" placeholder="Search" aria-label="Search the site"><button type="button">Go</button></nav> | |
| <main>{decoy}<h1>{html.escape(title)}</h1>{pre} | |
| <form onsubmit="return false"><div class="grid {'g2' if cols == 2 else ''}">{''.join(rows)}</div> | |
| <div class="btns"><button type="submit">Submit</button><button type="reset" class="sec">Reset</button></div></form></main> | |
| <footer>{''.join(f'<a href="#{n.lower()}">{n}</a>' for n in foot)}<p>© 2026 Northgate Inc.</p></footer></body></html>""" | |
| return page | |
| def make_forms(outdir): | |
| """Sayfaları outdir'e yazar, spec listesini döndürür.""" | |
| os.makedirs(outdir, exist_ok=True) | |
| specs = [] | |
| for k, (slug, title, style, cols, fl) in enumerate(FORMS): | |
| fields = [] | |
| for kind, label, value, extra in fl: | |
| f = {"kind": kind, "label": label, "value": value} | |
| if kind == "select": | |
| f["opts"] = extra | |
| if kind == "radio": | |
| f["group"] = extra | |
| fields.append(f) | |
| page = render(slug, title, style, cols, fields, seed=k + 3) | |
| with open(os.path.join(outdir, slug + ".html"), "w", encoding="utf-8") as fh: | |
| fh.write(page) | |
| specs.append({"name": slug, "title": title, "url": f"/{slug}.html", "stil": style, "kolon": cols, | |
| "remote": False, "fields": fields}) | |
| return specs | |
| def task_text(spec): | |
| """Mind2Web görevlerine benzer tek cümlelik görev; alanlar sırayla.""" | |
| parts = [] | |
| for f in spec["fields"]: | |
| k = f["kind"] | |
| if k in ("text", "textarea"): | |
| parts.append(f'type "{f["value"]}" in {f["label"]}') | |
| elif k == "select": | |
| parts.append(f'select "{f["value"]}" for {f["label"]}') | |
| elif k == "radio": | |
| parts.append(f'choose {f["label"]} for {f.get("group", "the option")}') | |
| else: | |
| parts.append(f'tick "{f["label"]}"') | |
| return f'On the "{spec["title"]}" page, fill out the form: ' + ", then ".join(parts) + "." | |
| # ------------------------------------------------------------------- gerçek siteler (erişilebilirse) | |
| def _f(kind, label, value, css, group=None): | |
| d = {"kind": kind, "label": label, "value": value, "css": css, "stil": "gercek"} | |
| if group: | |
| d["group"] = group | |
| return d | |
| REMOTE = [ | |
| {"name": "selenium_web_form", "title": "Web form", "url": "https://www.selenium.dev/selenium/web/web-form.html", "remote": True, | |
| "stil": "gercek", "fields": [ | |
| _f("text", "Text input", "Ali Yilmaz", "#my-text-id"), _f("text", "Password", "Sup3rSecret!", "input[name=my-password]"), | |
| _f("textarea", "Textarea", "Hello from the demo.", "textarea[name=my-textarea]"), | |
| _f("select", "Dropdown (select)", "Two", "select[name=my-select]")]}, | |
| {"name": "httpbin_pizza", "title": "Pizza order form", "url": "https://httpbin.org/forms/post", "remote": True, "stil": "gercek", "fields": [ | |
| _f("text", "Customer name", "Maria Garcia", "input[name=custname]"), _f("text", "Telephone", "555 0134", "input[name=custtel]"), | |
| _f("text", "E-mail address", "maria.garcia@example.com", "input[name=custemail]"), | |
| _f("radio", "Medium", "", "input[name=size][value=medium]", "Pizza Size"), | |
| _f("checkbox", "Mushroom", "", "input[name=topping][value=mushroom]"), | |
| _f("textarea", "Delivery instructions", "Ring the bell twice.", "textarea[name=comments]")]}, | |
| {"name": "formy_form", "title": "Complete Web Form", "url": "https://formy-project.herokuapp.com/form", "remote": True, "stil": "gercek", "fields": [ | |
| _f("text", "First name", "John", "#first-name"), _f("text", "Last name", "Smith", "#last-name"), | |
| _f("text", "Job title", "Analyst", "#job-title"), _f("radio", "College", "", "#radio-button-2", "Highest level of education"), | |
| _f("checkbox", "Female", "", "#checkbox-2"), _f("select", "Years of experience", "2-4", "#select-menu")]}, | |
| {"name": "the_internet_login", "title": "Login Page", "url": "https://the-internet.herokuapp.com/login", "remote": True, "stil": "gercek", "fields": [ | |
| _f("text", "Username", "tomsmith", "#username"), _f("text", "Password", "SuperSecretPassword!", "#password")]}, | |
| {"name": "saucedemo_login", "title": "Swag Labs login", "url": "https://www.saucedemo.com/", "remote": True, "stil": "gercek", "fields": [ | |
| _f("text", "Username", "standard_user", "#user-name"), _f("text", "Password", "secret_sauce", "#password")]}, | |
| ] | |