opria123's picture
Adding the app script for the space
de248c7
raw
history blame
519 Bytes
import gradio as gr
from transformers import pipeline
# Load model from Hugging Face Hub
model_pipeline = pipeline("image-classification", model="opria123/detr-resnet-50-dc5-hardhat-finetuned")
def classify_image(image):
return model_pipeline(image)
# Create a Gradio interface
demo = gr.Interface(
fn=classify_image,
inputs=gr.Image(type="pil"),
outputs=gr.Label(num_top_classes=3),
title="Image Classifier",
description="Upload an image to see the classification results."
)
demo.launch()