jonathanagustin commited on
Commit
4e2bdd1
1 Parent(s): 63d71fd

use trained model

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -252,7 +252,16 @@ class LiveYouTubeObjectDetector:
252
  def __init__(self):
253
  """Initializes the LiveYouTubeObjectDetector with YOLO model and UI components."""
254
  logging.getLogger().setLevel(logging.DEBUG)
255
- self.model = YOLO("yolov8x.pt")
 
 
 
 
 
 
 
 
 
256
  self.streams = INITIAL_STREAMS
257
 
258
  # Gradio UI
 
252
  def __init__(self):
253
  """Initializes the LiveYouTubeObjectDetector with YOLO model and UI components."""
254
  logging.getLogger().setLevel(logging.DEBUG)
255
+ model_url = "https://huggingface.co/aai521-group6/yolov8x-coco/resolve/main/yolov8x-coco.pt?download=true"
256
+ local_model_path = "yolov8x-coco.pt"
257
+ response = requests.get(model_url)
258
+ if response.status_code == 200:
259
+ with open(local_model_path, "wb") as f:
260
+ f.write(response.content)
261
+ print("Model downloaded successfully.")
262
+ else:
263
+ raise Exception(f"Failed to download model: Status code {response.status_code}")
264
+ self.model = YOLO(local_model_path)
265
  self.streams = INITIAL_STREAMS
266
 
267
  # Gradio UI