Security-AI-Agent-Vision / gradio_app.py
ThiSecur's picture
Create gradio_app.py
9a1cce8 verified
raw
history blame contribute delete
679 Bytes
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()