Update README.md
Browse files
README.md
CHANGED
|
@@ -13,6 +13,9 @@ tags:
|
|
| 13 |
- Classcode
|
| 14 |
- '10'
|
| 15 |
---
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
```py
|
| 18 |
Classification Report:
|
|
@@ -35,3 +38,88 @@ Genshin Impact 0.9831 0.9890 0.9860 1000
|
|
| 35 |
```
|
| 36 |
|
| 37 |

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
- Classcode
|
| 14 |
- '10'
|
| 15 |
---
|
| 16 |
+
# **Gameplay-Classcode-10**
|
| 17 |
+
|
| 18 |
+
> **Gameplay-Classcode-10** is a vision-language model fine-tuned from **google/siglip2-base-patch16-224** using the **SiglipForImageClassification** architecture. It classifies gameplay screenshots or thumbnails into one of ten popular video game titles.
|
| 19 |
|
| 20 |
```py
|
| 21 |
Classification Report:
|
|
|
|
| 38 |
```
|
| 39 |
|
| 40 |

|
| 41 |
+
|
| 42 |
+
The model predicts one of the following **game categories**:
|
| 43 |
+
|
| 44 |
+
- **0:** Among Us
|
| 45 |
+
- **1:** Apex Legends
|
| 46 |
+
- **2:** Fortnite
|
| 47 |
+
- **3:** Forza Horizon
|
| 48 |
+
- **4:** Free Fire
|
| 49 |
+
- **5:** Genshin Impact
|
| 50 |
+
- **6:** God of War
|
| 51 |
+
- **7:** Minecraft
|
| 52 |
+
- **8:** Roblox
|
| 53 |
+
- **9:** Terraria
|
| 54 |
+
|
| 55 |
+
---
|
| 56 |
+
|
| 57 |
+
# **Run with Transformers 🤗**
|
| 58 |
+
|
| 59 |
+
```python
|
| 60 |
+
!pip install -q transformers torch pillow gradio
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
```python
|
| 64 |
+
import gradio as gr
|
| 65 |
+
from transformers import AutoImageProcessor, SiglipForImageClassification
|
| 66 |
+
from PIL import Image
|
| 67 |
+
import torch
|
| 68 |
+
|
| 69 |
+
# Load model and processor
|
| 70 |
+
model_name = "prithivMLmods/Gameplay-Classcode-10" # Replace with your actual model path
|
| 71 |
+
model = SiglipForImageClassification.from_pretrained(model_name)
|
| 72 |
+
processor = AutoImageProcessor.from_pretrained(model_name)
|
| 73 |
+
|
| 74 |
+
# Label mapping
|
| 75 |
+
id2label = {
|
| 76 |
+
0: "Among Us",
|
| 77 |
+
1: "Apex Legends",
|
| 78 |
+
2: "Fortnite",
|
| 79 |
+
3: "Forza Horizon",
|
| 80 |
+
4: "Free Fire",
|
| 81 |
+
5: "Genshin Impact",
|
| 82 |
+
6: "God of War",
|
| 83 |
+
7: "Minecraft",
|
| 84 |
+
8: "Roblox",
|
| 85 |
+
9: "Terraria"
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
def classify_game(image):
|
| 89 |
+
"""Predicts the game title based on the gameplay image."""
|
| 90 |
+
image = Image.fromarray(image).convert("RGB")
|
| 91 |
+
inputs = processor(images=image, return_tensors="pt")
|
| 92 |
+
|
| 93 |
+
with torch.no_grad():
|
| 94 |
+
outputs = model(**inputs)
|
| 95 |
+
logits = outputs.logits
|
| 96 |
+
probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
|
| 97 |
+
|
| 98 |
+
predictions = {id2label[i]: round(probs[i], 3) for i in range(len(probs))}
|
| 99 |
+
predictions = dict(sorted(predictions.items(), key=lambda item: item[1], reverse=True))
|
| 100 |
+
return predictions
|
| 101 |
+
|
| 102 |
+
# Gradio interface
|
| 103 |
+
iface = gr.Interface(
|
| 104 |
+
fn=classify_game,
|
| 105 |
+
inputs=gr.Image(type="numpy"),
|
| 106 |
+
outputs=gr.Label(label="Game Prediction Scores"),
|
| 107 |
+
title="Gameplay-Classcode-10",
|
| 108 |
+
description="Upload a gameplay screenshot or thumbnail to identify the game title (Among Us, Fortnite, Minecraft, etc.)."
|
| 109 |
+
)
|
| 110 |
+
|
| 111 |
+
# Launch the app
|
| 112 |
+
if __name__ == "__main__":
|
| 113 |
+
iface.launch()
|
| 114 |
+
```
|
| 115 |
+
|
| 116 |
+
---
|
| 117 |
+
|
| 118 |
+
# **Intended Use**
|
| 119 |
+
|
| 120 |
+
This model can be used for:
|
| 121 |
+
|
| 122 |
+
- **Automatic tagging of gameplay content for streamers and creators**
|
| 123 |
+
- **Organizing gaming datasets**
|
| 124 |
+
- **Enhancing searchability in gameplay video repositories**
|
| 125 |
+
- **Training AI systems for game-related content moderation or recommendations**
|