Update README.md
Browse files
README.md
CHANGED
|
@@ -14,6 +14,12 @@ tags:
|
|
| 14 |
- CrossEmoji Classifier
|
| 15 |
---
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
```py
|
| 18 |
Classification Report:
|
| 19 |
precision recall f1-score support
|
|
@@ -36,3 +42,85 @@ tags:
|
|
| 36 |
```
|
| 37 |
|
| 38 |

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
- CrossEmoji Classifier
|
| 15 |
---
|
| 16 |
|
| 17 |
+

|
| 18 |
+
|
| 19 |
+
# **Emoji-Scope**
|
| 20 |
+
|
| 21 |
+
> **Emoji-Scope** is an image classification vision-language encoder model fine-tuned from **google/siglip2-base-patch16-224** for a single-label classification task. It is designed to classify emoji images into different style categories using the **SiglipForImageClassification** architecture.
|
| 22 |
+
|
| 23 |
```py
|
| 24 |
Classification Report:
|
| 25 |
precision recall f1-score support
|
|
|
|
| 42 |
```
|
| 43 |
|
| 44 |

|
| 45 |
+
|
| 46 |
+
The model categorizes images into eleven emoji styles:
|
| 47 |
+
- **Class 0:** "Apple Style"
|
| 48 |
+
- **Class 1:** "DoCoMo Style"
|
| 49 |
+
- **Class 2:** "Facebook Style"
|
| 50 |
+
- **Class 3:** "Gmail Style"
|
| 51 |
+
- **Class 4:** "Google Style"
|
| 52 |
+
- **Class 5:** "JoyPixels Style"
|
| 53 |
+
- **Class 6:** "KDDI Style"
|
| 54 |
+
- **Class 7:** "Samsung Style"
|
| 55 |
+
- **Class 8:** "SoftBank Style"
|
| 56 |
+
- **Class 9:** "Twitter Style"
|
| 57 |
+
- **Class 10:** "Windows Style"
|
| 58 |
+
|
| 59 |
+
# **Run with Transformers🤗**
|
| 60 |
+
|
| 61 |
+
```python
|
| 62 |
+
!pip install -q transformers torch pillow gradio
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
```python
|
| 66 |
+
import gradio as gr
|
| 67 |
+
from transformers import AutoImageProcessor
|
| 68 |
+
from transformers import SiglipForImageClassification
|
| 69 |
+
from transformers.image_utils import load_image
|
| 70 |
+
from PIL import Image
|
| 71 |
+
import torch
|
| 72 |
+
|
| 73 |
+
# Load model and processor
|
| 74 |
+
model_name = "prithivMLmods/Emoji-Scope"
|
| 75 |
+
model = SiglipForImageClassification.from_pretrained(model_name)
|
| 76 |
+
processor = AutoImageProcessor.from_pretrained(model_name)
|
| 77 |
+
|
| 78 |
+
def emoji_classification(image):
|
| 79 |
+
"""Predicts the style category of an emoji image."""
|
| 80 |
+
image = Image.fromarray(image).convert("RGB")
|
| 81 |
+
inputs = processor(images=image, return_tensors="pt")
|
| 82 |
+
|
| 83 |
+
with torch.no_grad():
|
| 84 |
+
outputs = model(**inputs)
|
| 85 |
+
logits = outputs.logits
|
| 86 |
+
probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
|
| 87 |
+
|
| 88 |
+
labels = {
|
| 89 |
+
"0": "Apple Style",
|
| 90 |
+
"1": "DoCoMo Style",
|
| 91 |
+
"2": "Facebook Style",
|
| 92 |
+
"3": "Gmail Style",
|
| 93 |
+
"4": "Google Style",
|
| 94 |
+
"5": "JoyPixels Style",
|
| 95 |
+
"6": "KDDI Style",
|
| 96 |
+
"7": "Samsung Style",
|
| 97 |
+
"8": "SoftBank Style",
|
| 98 |
+
"9": "Twitter Style",
|
| 99 |
+
"10": "Windows Style"
|
| 100 |
+
}
|
| 101 |
+
predictions = {labels[str(i)]: round(probs[i], 3) for i in range(len(probs))}
|
| 102 |
+
|
| 103 |
+
return predictions
|
| 104 |
+
|
| 105 |
+
# Create Gradio interface
|
| 106 |
+
iface = gr.Interface(
|
| 107 |
+
fn=emoji_classification,
|
| 108 |
+
inputs=gr.Image(type="numpy"),
|
| 109 |
+
outputs=gr.Label(label="Prediction Scores"),
|
| 110 |
+
title="Emoji Style Classification",
|
| 111 |
+
description="Upload an emoji image to classify its style."
|
| 112 |
+
)
|
| 113 |
+
|
| 114 |
+
# Launch the app
|
| 115 |
+
if __name__ == "__main__":
|
| 116 |
+
iface.launch()
|
| 117 |
+
```
|
| 118 |
+
|
| 119 |
+
# **Intended Use:**
|
| 120 |
+
|
| 121 |
+
The **Emoji-Scope** model is designed to classify emoji images based on different style categories. Potential use cases include:
|
| 122 |
+
|
| 123 |
+
- **Emoji Standardization:** Identifying different emoji styles across platforms.
|
| 124 |
+
- **User Experience Design:** Helping developers ensure consistency in emoji usage.
|
| 125 |
+
- **Digital Art & Design:** Assisting artists in selecting preferred emoji styles.
|
| 126 |
+
- **Educational Purposes:** Teaching differences in emoji representation.
|