philschmid HF staff commited on
Commit
8ccead5
1 Parent(s): 7468751

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +3 -0
handler.py CHANGED
@@ -9,6 +9,9 @@ from io import BytesIO
9
  # set device
10
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
11
 
 
 
 
12
  class EndpointHandler():
13
  def __init__(self, path=""):
14
  # load the optimized model
 
9
  # set device
10
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
11
 
12
+ if device.type != 'cuda':
13
+ raise ValueError("need to run on GPU")
14
+
15
  class EndpointHandler():
16
  def __init__(self, path=""):
17
  # load the optimized model