Jasper Lu
commited on
Commit
·
ac64690
1
Parent(s):
4efd111
to cuda
Browse files- handler.py +2 -1
handler.py
CHANGED
|
@@ -17,8 +17,9 @@ class EndpointHandler():
|
|
| 17 |
|
| 18 |
def __call__(self, data: Any) -> List[List[Dict[str, float]]]:
|
| 19 |
url = data.pop("inputs", data)
|
|
|
|
| 20 |
image = Image.open(requests.get(url, stream=True).raw)
|
| 21 |
-
inputs = self.processor(images=image, return_tensors="pt").
|
| 22 |
|
| 23 |
with torch.no_grad():
|
| 24 |
outputs = self.model(**inputs)
|
|
|
|
| 17 |
|
| 18 |
def __call__(self, data: Any) -> List[List[Dict[str, float]]]:
|
| 19 |
url = data.pop("inputs", data)
|
| 20 |
+
device = "cuda"
|
| 21 |
image = Image.open(requests.get(url, stream=True).raw)
|
| 22 |
+
inputs = self.processor(images=image, return_tensors="pt").to(device)
|
| 23 |
|
| 24 |
with torch.no_grad():
|
| 25 |
outputs = self.model(**inputs)
|