Spaces:
Paused
Paused
Update inference_from_video.py
Browse files- inference_from_video.py +6 -1
inference_from_video.py
CHANGED
@@ -3,6 +3,11 @@ import copy
|
|
3 |
import json
|
4 |
import time
|
5 |
import torch
|
|
|
|
|
|
|
|
|
|
|
6 |
import argparse
|
7 |
from PIL import Image
|
8 |
import numpy as np
|
@@ -120,7 +125,7 @@ def main():
|
|
120 |
model.eval()
|
121 |
|
122 |
# Load Trained Weight #
|
123 |
-
|
124 |
if args.model.endswith(".pt") or args.model.endswith(".bin"):
|
125 |
model.load_state_dict(torch.load(args.model), strict=False)
|
126 |
else:
|
|
|
3 |
import json
|
4 |
import time
|
5 |
import torch
|
6 |
+
|
7 |
+
# Check if CUDA is available and set the device
|
8 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
9 |
+
print("Using device:", device)
|
10 |
+
|
11 |
import argparse
|
12 |
from PIL import Image
|
13 |
import numpy as np
|
|
|
125 |
model.eval()
|
126 |
|
127 |
# Load Trained Weight #
|
128 |
+
|
129 |
if args.model.endswith(".pt") or args.model.endswith(".bin"):
|
130 |
model.load_state_dict(torch.load(args.model), strict=False)
|
131 |
else:
|