Views
No views yet

WebClick-AgentBrowse-SigLIP2 is a vision-language encoder model fine-tuned fromgoogle/siglip2-base-patch16-224for multi-class image classification.
It is trained to detect and classify web UI click regions into three classes:agentbrowse,calendars, andhumanbrowse. The model utilizes theSiglipForImageClassificationarchitecture.
[!note] SigLIP 2: Multilingual Vision-Language Encoders with Improved Semantic Understanding, Localization, and Dense Features
https://arxiv.org/pdf/2502.14786
[!note] agent-browse / calendars / human-browse
1Classification Report:
2 precision recall f1-score support
3
4 agentbrowse 0.9556 0.8763 0.9142 590
5 calendars 0.9707 0.9413 0.9558 528
6 humanbrowse 0.8481 0.9539 0.8979 521
7
8 accuracy 0.9219 1639
9 macro avg 0.9248 0.9238 0.9226 1639
10weighted avg 0.9263 0.9219 0.9224 1639
Class 0: agentbrowse
Class 1: calendars
Class 2: humanbrowse
pip install -q transformers torch pillow gradio hf_xet1import gradio as gr
2from transformers import AutoImageProcessor, SiglipForImageClassification
3from PIL import Image
4import torch
5
6# Load model and processor
7model_name = "prithivMLmods/WebClick-AgentBrowse-SigLIP2" # Replace with actual HF model repo
8model = SiglipForImageClassification.from_pretrained(model_name)
9processor = AutoImageProcessor.from_pretrained(model_name)
10
11# Updated label mapping
12id2label = {
13 "0": "agentbrowse",
14 "1": "calendars",
15 "2": "humanbrowse"
16}
17
18def classify_image(image):
19 image = Image.fromarray(image).convert("RGB")
20 inputs = processor(images=image, return_tensors="pt")
21
22 with torch.no_grad():
23 outputs = model(**inputs)
24 logits = outputs.logits
25 probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
26
27 prediction = {
28 id2label[str(i)]: round(probs[i], 3) for i in range(len(probs))
29 }
30
31 return prediction
32
33# Gradio Interface
34iface = gr.Interface(
35 fn=classify_image,
36 inputs=gr.Image(type="numpy"),
37 outputs=gr.Label(num_top_classes=3, label="Click Type Classification"),
38 title="WebClick AgentBrowse Classifier",
39 description="Upload a web UI screenshot to classify regions: agentbrowse, calendars, or humanbrowse."
40)
41
42if __name__ == "__main__":
43 iface.launch()1%%capture
2!pip install datasets==3.2.01from datasets import load_dataset
2
3# Load the dataset
4dataset = load_dataset("Hcompany/WebClick")
5
6# Extract unique masterCategory values (assuming it's a string field)
7labels = sorted(set(example["bucket"] for example in dataset["test"]))
8
9# Create id2label mapping
10id2label = {str(i): label for i, label in enumerate(labels)}
11
12# Print the mapping
13print(id2label){'0': 'agentbrowse', '1': 'calendars', '2': 'humanbrowse'}