Mtemel commited on
Commit
f95373c
·
verified ·
1 Parent(s): ba0e35c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
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
- # Modeli yükleme
9
- model = YOLO("keremberke/yolov8n-pcb-defect-segmentation")
 
 
 
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()