Antoine245's picture
Update app.py
4b7f793
import torch
import gradio as gr
from transformers import pipeline
def predict(image):
classifier = pipeline(task="image-classification")
preds = classifier(image)
return {pred["label"]: round(float(pred["score"]), 4) for pred in preds}
description = """
"""
interface = gr.Interface(
fn=predict,
inputs=[
gr.inputs.Image(label="Image to classify", type="pil"),
],
outputs=gr.outputs.Label(),
examples=[
["rafale.jpg",],
],
title="Image Classifier",
description=description
)
interface.launch()