File size: 567 Bytes
bd8af31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
from transformers import pipeline

# Загружаем модель
classifier = pipeline("image-classification", model="mmgyorke/vit-world-landmarks")

def predict(img):
    results = classifier(img)
    return {r["label"]: float(r["score"]) for r in results}

demo = gr.Interface(
    fn=predict,
    inputs=gr.Image(type="pil"),
    outputs=gr.Label(num_top_classes=5),
    title="🏛️ World Landmark Classifier",
    description="Загрузи фото и узнай, что за архитектурный объект!"
)

demo.launch()