sb
Browse files
app.py
CHANGED
|
@@ -24,7 +24,7 @@ net_c=net_c.to('cpu')
|
|
| 24 |
#net_c=net_c.to('cuda')
|
| 25 |
net_i.eval().to('cuda')
|
| 26 |
net_c.eval().to('cuda')
|
| 27 |
-
|
| 28 |
def align(x1):
|
| 29 |
h, w = x1.shape[:2]
|
| 30 |
h, w = h // 32 * 32, w // 32 * 32
|
|
@@ -33,8 +33,8 @@ def align(x1):
|
|
| 33 |
|
| 34 |
def pipe(img):
|
| 35 |
img=align(img)
|
| 36 |
-
|
| 37 |
-
image_tensor=
|
| 38 |
return predict(image_tensor)
|
| 39 |
|
| 40 |
@spaces.GPU(duration=120)
|
|
|
|
| 24 |
#net_c=net_c.to('cuda')
|
| 25 |
net_i.eval().to('cuda')
|
| 26 |
net_c.eval().to('cuda')
|
| 27 |
+
image_tensor = torch.zeros((1, 3, 420, 420), device='cuda')
|
| 28 |
def align(x1):
|
| 29 |
h, w = x1.shape[:2]
|
| 30 |
h, w = h // 32 * 32, w // 32 * 32
|
|
|
|
| 33 |
|
| 34 |
def pipe(img):
|
| 35 |
img=align(img)
|
| 36 |
+
img=TF.to_tensor(img)
|
| 37 |
+
image_tensor=img.unsqueeze(0)
|
| 38 |
return predict(image_tensor)
|
| 39 |
|
| 40 |
@spaces.GPU(duration=120)
|