cazzz307 commited on
Commit
2b2d6c4
·
verified ·
1 Parent(s): d69b381

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -4,19 +4,17 @@ from ultralytics import YOLO
4
  from huggingface_hub import snapshot_download
5
  import os
6
 
7
- # Download the model from HF Hub (if not already cached)
8
  model_dir = snapshot_download("cazzz307/Pothole-Finetuned-YoloV8")
9
- model_path = os.path.join(model_dir, "best.pt")
10
 
11
- # Load model
12
  model = YOLO(model_path)
13
 
14
  def detect_potholes(image: Image.Image):
15
  results = model(image)
16
- annotated_img = results[0].plot() # Returns numpy array with drawings
17
  return Image.fromarray(annotated_img)
18
 
19
- # Gradio Interface
20
  demo = gr.Interface(
21
  fn=detect_potholes,
22
  inputs=gr.Image(type="pil"),
 
4
  from huggingface_hub import snapshot_download
5
  import os
6
 
 
7
  model_dir = snapshot_download("cazzz307/Pothole-Finetuned-YoloV8")
8
+ model_path = os.path.join(model_dir, "Yolov8-fintuned-on-potholes.pt")
9
 
 
10
  model = YOLO(model_path)
11
 
12
  def detect_potholes(image: Image.Image):
13
  results = model(image)
14
+ annotated_img = results[0].plot()
15
  return Image.fromarray(annotated_img)
16
 
17
+
18
  demo = gr.Interface(
19
  fn=detect_potholes,
20
  inputs=gr.Image(type="pil"),