tarasevicius commited on
Commit
2b8f883
·
1 Parent(s): 45c744f

fix: revert to a previous model

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -2,15 +2,16 @@ import gradio as gr
2
  import torch
3
  from PIL import Image
4
  import numpy as np
 
 
5
  import cv2
6
 
7
  # Download the model from Hugging Face Hub
8
- model_path = 'latest.pt'
9
 
10
  # Load the YOLOv5 model
11
  model = torch.hub.load('ultralytics/yolov5', 'custom', path=model_path)
12
  model.line_thickness = 3 # Set the thickness of the bounding box lines
13
- model.conf = 0.001 # Set the confidence threshold for detections
14
 
15
  # Print model class names
16
  print("Model class names:", model.names)
 
2
  import torch
3
  from PIL import Image
4
  import numpy as np
5
+ from huggingface_hub import hf_hub_download
6
+
7
  import cv2
8
 
9
  # Download the model from Hugging Face Hub
10
+ model_path = hf_hub_download(repo_id='ethandavey/yoloV5-coursework-model', filename='model.pt')
11
 
12
  # Load the YOLOv5 model
13
  model = torch.hub.load('ultralytics/yolov5', 'custom', path=model_path)
14
  model.line_thickness = 3 # Set the thickness of the bounding box lines
 
15
 
16
  # Print model class names
17
  print("Model class names:", model.names)