import gradio as gr from transformers import pipeline classifier = pipeline( "image-classification", model="google/vit-base-patch16-224" ) def classify_image(image, top_k=3): results = classifier(image) sorted_results = sorted(results, key=lambda x: x["score"], reverse=True) output_dict = {result["label"]: result["score"] for result in sorted_results[:top_k]} return output_dict with gr.Blocks() as demo: with gr.Row(): gr.HTML("