Zencriel's picture
Upload folder using huggingface_hub
7370e5c verified
raw
history blame contribute delete
640 Bytes
import gradio as gr
import numpy as np
import joblib
from ultralytics import YOLO
load_model = YOLO("best.pt")
def predict(image):
result = load_model.predict(source=image, imgsz = 640, conf = 0.25)
annotated_img = result[0].plot()
annotated_img = annotated_img[:, :, ::-1]
return annotated_img
app = gr.Interface(
fn = predict,
inputs = gr.Image(type="numpy", label="Upload an image"),
outputs = gr.Image(type="numpy", label="Detect Brain Tumor"),
title = "Brain Tumor Detection",
description="Upload an image. The model will detect and annotate brain tumor."
)
app.launch(share = True)