Update app.py
Browse files
app.py
CHANGED
|
@@ -22,6 +22,7 @@ import numpy as np
|
|
| 22 |
import os
|
| 23 |
import sys
|
| 24 |
import torch
|
|
|
|
| 25 |
import matplotlib.pyplot as plt
|
| 26 |
import torchvision.transforms.functional as F
|
| 27 |
from torchvision.io import read_video
|
|
@@ -227,6 +228,7 @@ def infer():
|
|
| 227 |
# res = cv2.remap(img, flow, None, cv2.INTER_LINEAR)
|
| 228 |
res = cv2.remap(frame1pil, numpy_array_flow, None, cv2.INTER_LANCZOS4)
|
| 229 |
print(res)
|
|
|
|
| 230 |
res.save('wraped.jpg')
|
| 231 |
return "done", "predicted_flow.jpg", ["flofile.flo"], 'frame_input.jpg', 'wraped.jpg'
|
| 232 |
####################################
|
|
|
|
| 22 |
import os
|
| 23 |
import sys
|
| 24 |
import torch
|
| 25 |
+
from PIL import Image
|
| 26 |
import matplotlib.pyplot as plt
|
| 27 |
import torchvision.transforms.functional as F
|
| 28 |
from torchvision.io import read_video
|
|
|
|
| 228 |
# res = cv2.remap(img, flow, None, cv2.INTER_LINEAR)
|
| 229 |
res = cv2.remap(frame1pil, numpy_array_flow, None, cv2.INTER_LANCZOS4)
|
| 230 |
print(res)
|
| 231 |
+
res = Image.fromarray(res)
|
| 232 |
res.save('wraped.jpg')
|
| 233 |
return "done", "predicted_flow.jpg", ["flofile.flo"], 'frame_input.jpg', 'wraped.jpg'
|
| 234 |
####################################
|