Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,11 +6,12 @@ import kornia.feature as KF
|
|
| 6 |
import torch
|
| 7 |
import numpy as np
|
| 8 |
|
| 9 |
-
def inference(
|
| 10 |
-
|
| 11 |
-
img_1 = img_1
|
| 12 |
-
|
| 13 |
-
img_2 = img_2
|
|
|
|
| 14 |
|
| 15 |
IS = ImageStitcher(KF.LoFTR(pretrained='outdoor'), estimator='ransac')
|
| 16 |
with torch.no_grad():
|
|
|
|
| 6 |
import torch
|
| 7 |
import numpy as np
|
| 8 |
|
| 9 |
+
def inference(img_1, img_2):
|
| 10 |
+
# Convert numpy arrays to Tensors
|
| 11 |
+
img_1: Tensor = K.image_to_tensor(img_1, keepdim=False).float() / 255.0
|
| 12 |
+
img_1 = img_1.unsqueeze(0) # Add batch dimension
|
| 13 |
+
img_2: Tensor = K.image_to_tensor(img_2, keepdim=False).float() / 255.0
|
| 14 |
+
img_2 = img_2.unsqueeze(0) # Add batch dimension
|
| 15 |
|
| 16 |
IS = ImageStitcher(KF.LoFTR(pretrained='outdoor'), estimator='ransac')
|
| 17 |
with torch.no_grad():
|