File size: 627 Bytes
9490f1c
 
 
 
 
 
 
effc345
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
---
license: apache-2.0
base_model:
- google/vit-base-patch16-224
pipeline_tag: image-classification
tags:
- image-classification
---

```py
import gradio as gr
from transformers import pipeline

classifier = pipeline("image-classification", model="TPM-28/MemeDetector")

def classify_image(image):
    predictions = classifier(image)
    result = {pred['label']: pred['score'] for pred in predictions}
    return result

interface = gr.Interface(
    fn=classify_image,
    inputs=gr.Image(type="pil"),
    outputs=gr.Label(num_top_classes=3),
    title="Meme Detector"
)

if __name__ == "__main__":
    interface.launch()
```