sergeipetrov
commited on
Commit
•
8d69278
1
Parent(s):
6862be6
Update handler.py
Browse files- handler.py +3 -2
handler.py
CHANGED
@@ -9,8 +9,9 @@ class EndpointHandler():
|
|
9 |
self.upscaler = UpscaleWithModel.from_pretrained("DAT_x3.pth").to("cuda")
|
10 |
|
11 |
def __call__(self, data):
|
12 |
-
|
13 |
-
|
|
|
14 |
|
15 |
output = outputs.reconstruction.data.squeeze().float().cpu().clamp_(0, 1).numpy()
|
16 |
output = np.moveaxis(output, source=0, destination=-1)
|
|
|
9 |
self.upscaler = UpscaleWithModel.from_pretrained("DAT_x3.pth").to("cuda")
|
10 |
|
11 |
def __call__(self, data):
|
12 |
+
img = data.pop("inputs", data)
|
13 |
+
img = Image.open(BytesIO(img))
|
14 |
+
output = upscaler(img, tiling=True, tile_width=768, tile_height=768, overlap=8)
|
15 |
|
16 |
output = outputs.reconstruction.data.squeeze().float().cpu().clamp_(0, 1).numpy()
|
17 |
output = np.moveaxis(output, source=0, destination=-1)
|