Views
No views yet

x-bot-profile-detection is a SigLIP2-based classification model designed to detect profile authenticity types on social media platforms (such as X/Twitter). It categorizes a profile image into four classes: bot, cyborg, real, or verified. Built ongoogle/siglip2-base-patch16-224, the model leverages advanced vision-language pretraining for robust image classification.
1Classification Report:
2 precision recall f1-score support
3
4 bot 0.9912 0.9960 0.9936 2500
5 cyborg 0.9940 0.9880 0.9910 2500
6 real 0.8634 0.9936 0.9239 2500
7 verified 0.9948 0.8460 0.9144 2500
8
9 accuracy 0.9559 10000
10 macro avg 0.9609 0.9559 0.9557 10000
11weighted avg 0.9609 0.9559 0.9557 10000
0: bot → Automated accounts
1: cyborg → Partially automated or suspiciously mixed behavior
2: real → Genuine human users
3: verified → Verified accounts or official profilespip install transformers torch pillow gradio1import gradio as gr
2from transformers import AutoImageProcessor, SiglipForImageClassification
3from PIL import Image
4import torch
5
6# Load model and processor
7model_name = "prithivMLmods/x-bot-profile-detection"
8model = SiglipForImageClassification.from_pretrained(model_name)
9processor = AutoImageProcessor.from_pretrained(model_name)
10
11# Define class mapping
12id2label = {
13 "0": "bot",
14 "1": "cyborg",
15 "2": "real",
16 "3": "verified"
17}
18
19def detect_profile_type(image):
20 image = Image.fromarray(image).convert("RGB")
21 inputs = processor(images=image, return_tensors="pt")
22
23 with torch.no_grad():
24 outputs = model(**inputs)
25 logits = outputs.logits
26 probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
27
28 prediction = {
29 id2label[str(i)]: round(probs[i], 3) for i in range(len(probs))
30 }
31
32 return prediction
33
34# Create Gradio UI
35iface = gr.Interface(
36 fn=detect_profile_type,
37 inputs=gr.Image(type="numpy"),
38 outputs=gr.Label(num_top_classes=4, label="Predicted Profile Type"),
39 title="x-bot-profile-detection",
40 description="Upload a social media profile picture to classify it as Bot, Cyborg, Real, or Verified using a SigLIP2 model."
41)
42
43if __name__ == "__main__":
44 iface.launch()