Spaces:
Sleeping
Sleeping
File size: 535 Bytes
d13c480 62de531 d13c480 7ebb272 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import torch
import cv2
import numpy as np
import gradio as gr
from ultralytics import YOLO
from pillow import Image
# Modeli yükleme
model = YOLO("keremberke/yolov8n-pcb-defect-segmentation")
def detect_defects(image):
results = model.predict(image, save=False)
annotated_image = results[0].plot() # Tahmin sonuçlarını çiz
return annotated_image
iface = gr.Interface(
fn=detect_defects,
inputs=gr.Image(type="pil"),
outputs=gr.Image(type="pil"),
title="PCB Defect Segmentation"
)
iface.launch()
|