|
|
--- |
|
|
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() |
|
|
``` |