SerenaTOUM's picture
Create app.py
9703332 verified
raw
history blame contribute delete
647 Bytes
from transformers import pipeline
classification = pipeline ("zero-shot-image-classification", model ="openai/clip-vit-large-patch14")
import gradio as gr
def classify_image(image):
labels = ["groupe1", "groupe2", "groupe3"]
classification = classification(image, labels)
return classification
image_input = gr.Image()
label_output = gr.Label(num_top_classes=3)
gr.Interface(fn=classify_image, inputs=image_input, outputs=label_output,
title="Zero-Shot Image Classification",
description="Classify images into predefined classes without fine-tuning the model.",
allow_flagging=False).launch()