yasserrmd commited on
Commit
01e83c8
1 Parent(s): d48f382

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -5,9 +5,8 @@ import torch
5
  import os
6
  import spaces
7
 
8
- # Load YOLOv10 model with CUDA if available
9
- device = 'cuda' if torch.cuda.is_available() else 'cpu'
10
- model = YOLOv10.from_pretrained('jameslahm/yolov10x').to(device)
11
 
12
  # Define activity categories based on detected objects
13
  activity_categories = {
@@ -33,6 +32,7 @@ def categorize_activity(detected_objects):
33
  # Function to process the video, detect objects, and generate a categorized journal with images
34
  @spaces.GPU
35
  def generate_journal_with_images(video_path):
 
36
  cap = cv2.VideoCapture(video_path)
37
  journal_entries = {}
38
  saved_images = []
 
5
  import os
6
  import spaces
7
 
8
+
9
+ model = YOLOv10.from_pretrained('jameslahm/yolov10x')
 
10
 
11
  # Define activity categories based on detected objects
12
  activity_categories = {
 
32
  # Function to process the video, detect objects, and generate a categorized journal with images
33
  @spaces.GPU
34
  def generate_journal_with_images(video_path):
35
+ model.to("cuda")
36
  cap = cv2.VideoCapture(video_path)
37
  journal_entries = {}
38
  saved_images = []