FredZhang7 commited on
Commit
ad73b87
·
1 Parent(s): 7689ab2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +7 -2
README.md CHANGED
@@ -26,6 +26,7 @@ import warnings
26
  warnings.filterwarnings("ignore")
27
 
28
  PATH_TO_IMAGE = 'https://images.unsplash.com/photo-1594568284297-7c64464062b1'
 
29
 
30
  def download_model():
31
  print("Downloading google_safesearch_mini.bin...")
@@ -52,8 +53,12 @@ def run():
52
  ])
53
  img = transform(img)
54
  img = img.unsqueeze(0)
55
- img = img.cpu()
56
- model = model.cpu()
 
 
 
 
57
  model.eval()
58
  with torch.no_grad():
59
  out, _ = model(img)
 
26
  warnings.filterwarnings("ignore")
27
 
28
  PATH_TO_IMAGE = 'https://images.unsplash.com/photo-1594568284297-7c64464062b1'
29
+ USE_CUDA = False
30
 
31
  def download_model():
32
  print("Downloading google_safesearch_mini.bin...")
 
53
  ])
54
  img = transform(img)
55
  img = img.unsqueeze(0)
56
+ if USE_CUDA:
57
+ img = img.cuda()
58
+ model = model.cuda()
59
+ else:
60
+ img = img.cpu()
61
+ model = model.cpu()
62
  model.eval()
63
  with torch.no_grad():
64
  out, _ = model(img)