jgrandat_demo1 / app.py
javiergrandat's picture
Elimino instalaci贸n de librer铆a
c5cf418 verified
raw
history blame contribute delete
598 Bytes
from transformers import pipeline
import gradio as gr
model = pipeline("image-classification", model="microsoft/swin-tiny-patch4-window7-224")
def classify_image(image):
predictions = model(image)
return {pred["label"]: pred["score"] for pred in predictions}
title = "Mi primer Demo"
description = "Test con Hugging Face y Gradio"
demo = gr.Interface(fn=classify_image,inputs=gr.Image(type="pil", label="Selecciona la imagen"),
outputs=gr.Label(num_top_classes=5),
title=title,
description=description,)
demo.launch()