Update README.md
Browse files
README.md
CHANGED
@@ -15,6 +15,12 @@ tags:
|
|
15 |
- experimental
|
16 |
---
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
```py
|
19 |
Classification Report:
|
20 |
precision recall f1-score support
|
@@ -29,4 +35,85 @@ Classification Report:
|
|
29 |
weighted avg 0.9609 0.9559 0.9557 10000
|
30 |
```
|
31 |
|
32 |
-

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
- experimental
|
16 |
---
|
17 |
|
18 |
+

|
19 |
+
|
20 |
+
# **x-bot-profile-detection**
|
21 |
+
|
22 |
+
> **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 on `google/siglip2-base-patch16-224`, the model leverages advanced vision-language pretraining for robust image classification.
|
23 |
+
|
24 |
```py
|
25 |
Classification Report:
|
26 |
precision recall f1-score support
|
|
|
35 |
weighted avg 0.9609 0.9559 0.9557 10000
|
36 |
```
|
37 |
|
38 |
+

|
39 |
+
|
40 |
+
---
|
41 |
+
|
42 |
+
## **Label Classes**
|
43 |
+
|
44 |
+
The model predicts one of the following profile types:
|
45 |
+
|
46 |
+
```
|
47 |
+
0: bot → Automated accounts
|
48 |
+
1: cyborg → Partially automated or suspiciously mixed behavior
|
49 |
+
2: real → Genuine human users
|
50 |
+
3: verified → Verified accounts or official profiles
|
51 |
+
```
|
52 |
+
|
53 |
+
---
|
54 |
+
|
55 |
+
## **Installation**
|
56 |
+
|
57 |
+
```bash
|
58 |
+
pip install transformers torch pillow gradio
|
59 |
+
```
|
60 |
+
|
61 |
+
---
|
62 |
+
|
63 |
+
## **Example Inference Code**
|
64 |
+
|
65 |
+
```python
|
66 |
+
import gradio as gr
|
67 |
+
from transformers import AutoImageProcessor, SiglipForImageClassification
|
68 |
+
from PIL import Image
|
69 |
+
import torch
|
70 |
+
|
71 |
+
# Load model and processor
|
72 |
+
model_name = "prithivMLmods/x-bot-profile-detection"
|
73 |
+
model = SiglipForImageClassification.from_pretrained(model_name)
|
74 |
+
processor = AutoImageProcessor.from_pretrained(model_name)
|
75 |
+
|
76 |
+
# Define class mapping
|
77 |
+
id2label = {
|
78 |
+
"0": "bot",
|
79 |
+
"1": "cyborg",
|
80 |
+
"2": "real",
|
81 |
+
"3": "verified"
|
82 |
+
}
|
83 |
+
|
84 |
+
def detect_profile_type(image):
|
85 |
+
image = Image.fromarray(image).convert("RGB")
|
86 |
+
inputs = processor(images=image, return_tensors="pt")
|
87 |
+
|
88 |
+
with torch.no_grad():
|
89 |
+
outputs = model(**inputs)
|
90 |
+
logits = outputs.logits
|
91 |
+
probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
|
92 |
+
|
93 |
+
prediction = {
|
94 |
+
id2label[str(i)]: round(probs[i], 3) for i in range(len(probs))
|
95 |
+
}
|
96 |
+
|
97 |
+
return prediction
|
98 |
+
|
99 |
+
# Create Gradio UI
|
100 |
+
iface = gr.Interface(
|
101 |
+
fn=detect_profile_type,
|
102 |
+
inputs=gr.Image(type="numpy"),
|
103 |
+
outputs=gr.Label(num_top_classes=4, label="Predicted Profile Type"),
|
104 |
+
title="x-bot-profile-detection",
|
105 |
+
description="Upload a social media profile picture to classify it as Bot, Cyborg, Real, or Verified using a SigLIP2 model."
|
106 |
+
)
|
107 |
+
|
108 |
+
if __name__ == "__main__":
|
109 |
+
iface.launch()
|
110 |
+
```
|
111 |
+
|
112 |
+
---
|
113 |
+
|
114 |
+
## **Use Cases**
|
115 |
+
|
116 |
+
* Social media moderation and automation detection
|
117 |
+
* Anomaly detection in public discourse
|
118 |
+
* Botnet analysis and influence operation research
|
119 |
+
* Platform integrity and trust verification
|