vashu2425 commited on
Commit
ec5de95
·
verified ·
1 Parent(s): f901fd4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -5,15 +5,15 @@ import cv2
5
  import numpy as np
6
  from ultralytics import YOLO
7
 
8
- # # Clear GPU memory
9
- # torch.cuda.empty_cache()
10
 
11
- # # Load YOLO model
12
- # @st.cache_resource
13
  def load_model():
14
- # Dynamically select device (GPU if available, otherwise CPU)
15
- # device = 'cuda' if torch.cuda.is_available() else 'cpu'
16
- model = YOLO('./best .pt') # Replace with your model path
17
  return model
18
 
19
  model = load_model()
 
5
  import numpy as np
6
  from ultralytics import YOLO
7
 
8
+ # Clear GPU memory
9
+ torch.cuda.empty_cache()
10
 
11
+ # Load YOLO model
12
+ @st.cache_resource
13
  def load_model():
14
+ Dynamically select device (GPU if available, otherwise CPU)
15
+ device = 'cuda' if torch.cuda.is_available() else 'cpu'
16
+ model = YOLO('./best .pt').to(device) # Replace with your model path
17
  return model
18
 
19
  model = load_model()