Spaces:
Sleeping
Sleeping
File size: 521 Bytes
4a911b5 35ef7f2 4a911b5 35ef7f2 4a911b5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import gradio as gr
from transformers import pipeline
# Wybierz lżejszy model
model_name = "facebook/deit-tiny-patch16-224"
pipe = pipeline("image-classification", model=model_name)
def classify_image(img):
results = pipe(img)
return {res["label"]: float(res["score"]) for res in results}
demo = gr.Interface(
fn=classify_image,
inputs=gr.Image(type="filepath"),
outputs=gr.Label(num_top_classes=5),
title="Lekka klasyfikacja obrazów",
description=f"Model: {model_name}"
)
demo.launch() |