Spaces:
Sleeping
Sleeping
File size: 679 Bytes
9a1cce8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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() |