Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
from PIL import Image | |
# Load your model | |
agent = pipeline("image-classification", model="your-username/your-model-name") | |
def analyze_image(image): | |
results = agent(image) | |
# Format results for clean output | |
return {r["label"]: r["score"] for r in results} | |
# Create UI | |
demo = gr.Interface( | |
fn=analyze_image, | |
inputs=gr.Image(type="pil"), | |
outputs=gr.Label(num_top_classes=3), | |
examples=["example1.jpg", "example2.jpg"], | |
title="π‘οΈ AI Vision Agent: Security Compliance Assistant", | |
description="Upload an image to detect clean-desk violations, unattended devices, and more!", | |
) | |
demo.launch() |