sergeipetrov commited on
Commit
ad067ed
1 Parent(s): dc4454d

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +2 -1
handler.py CHANGED
@@ -24,7 +24,8 @@ class EndpointHandler:
24
  def __call__(self, data: Any):
25
  image = data["inputs"]
26
  inputs = self.processor(image, return_tensors="pt").to(device)
27
- outputs = self.model(**inputs)
 
28
 
29
  output = outputs.reconstruction.data.squeeze().float().cpu().clamp_(0, 1).numpy()
30
  output = np.moveaxis(output, source=0, destination=-1)
 
24
  def __call__(self, data: Any):
25
  image = data["inputs"]
26
  inputs = self.processor(image, return_tensors="pt").to(device)
27
+ with torch.no_grad():
28
+ outputs = self.model(**inputs)
29
 
30
  output = outputs.reconstruction.data.squeeze().float().cpu().clamp_(0, 1).numpy()
31
  output = np.moveaxis(output, source=0, destination=-1)