Spaces:
Sleeping
Sleeping
File size: 613 Bytes
ed5a35c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | import gradio as gr
from ultralytics import YOLO
from PIL import Image
# Load the trained model
model = YOLO('bccd_yolov8.pt') # Make sure the model file is in the same folder as app.py
# Prediction function
def predict(image):
results = model(image)
annotated_image = results[0].plot() # Draw bounding boxes
return Image.fromarray(annotated_image)
# Gradio Interface
iface = gr.Interface(
fn=predict,
inputs=gr.Image(type="pil"),
outputs=gr.Image(type="pil"),
title="BCCD Object Detection",
description="Upload an image to detect RBC, WBC, and Platelets.",
)
iface.launch()
|