import gradio as gr from transformers import pipeline classifier = pipeline("image-classification", model="XenArcAI/AIRealNet") def recognize(img): results = classifier(img) return {r["label"]: round(r["score"], 3) for r in results} with gr.Blocks() as demo: # removed theme for compatibility gr.Markdown( """ # **XenArcAI** # 🖼️ AIRealNet Image Recognition Upload an image and let **AIRealNet** identify what's inside. """ ) with gr.Row(): with gr.Column(): inp = gr.Image(type="pil", label="Upload Image") btn = gr.Button("Run Recognition") with gr.Column(): out = gr.Label(num_top_classes=2, label="Predictions") examples = gr.Examples( examples=["examples/cat.jpg", "examples/dog.jpg", "examples/car.jpg"], inputs=inp ) btn.click(fn=recognize, inputs=inp, outputs=[out]) demo.launch()