Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,7 +27,20 @@ model.load_state_dict(state_dict, strict=False)
|
|
| 27 |
model.eval()
|
| 28 |
|
| 29 |
def predict(im):
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
x = torch.tensor(im, dtype=torch.float32).unsqueeze(0).unsqueeze(0) / 255.
|
| 32 |
|
| 33 |
with torch.no_grad():
|
|
|
|
| 27 |
model.eval()
|
| 28 |
|
| 29 |
def predict(im):
|
| 30 |
+
|
| 31 |
+
def list_shape(lst):
|
| 32 |
+
if not isinstance(lst, list):
|
| 33 |
+
return []
|
| 34 |
+
if not lst:
|
| 35 |
+
return [0]
|
| 36 |
+
shapes = [list_shape(sublist) for sublist in lst]
|
| 37 |
+
max_shape = max(shapes, key=len)
|
| 38 |
+
return [len(lst)] + [max(dimensions[i] if i < len(dimensions) else 0 for dimensions in shapes) for i in range(len(max_shape))]
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
print(list_shape(im))
|
| 42 |
+
|
| 43 |
+
|
| 44 |
x = torch.tensor(im, dtype=torch.float32).unsqueeze(0).unsqueeze(0) / 255.
|
| 45 |
|
| 46 |
with torch.no_grad():
|