Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,9 +4,13 @@ import numpy as np
|
|
4 |
import gradio as gr
|
5 |
from ultralytics import YOLO
|
6 |
from PIL import Image
|
|
|
7 |
|
8 |
-
#
|
9 |
-
|
|
|
|
|
|
|
10 |
|
11 |
def detect_defects(image):
|
12 |
results = model.predict(image, save=False)
|
@@ -21,4 +25,3 @@ iface = gr.Interface(
|
|
21 |
)
|
22 |
|
23 |
iface.launch()
|
24 |
-
|
|
|
4 |
import gradio as gr
|
5 |
from ultralytics import YOLO
|
6 |
from PIL import Image
|
7 |
+
from huggingface_hub import hf_hub_download
|
8 |
|
9 |
+
# Hugging Face'ten YOLO modelini indir
|
10 |
+
model_path = hf_hub_download("keremberke/yolov8n-pcb-defect-segmentation", "yolov8n-pcb-defect-segmentation.pt")
|
11 |
+
|
12 |
+
# Modeli yükle
|
13 |
+
model = YOLO(model_path)
|
14 |
|
15 |
def detect_defects(image):
|
16 |
results = model.predict(image, save=False)
|
|
|
25 |
)
|
26 |
|
27 |
iface.launch()
|
|