Update app.py
Browse files
app.py
CHANGED
@@ -195,21 +195,23 @@ def infer():
|
|
195 |
flow_img = flow_to_image(predicted_flow).to("cpu")
|
196 |
# output_folder = "/tmp/" # Update this to the folder of your choice
|
197 |
write_jpeg(flow_img, f"predicted_flow.jpg")
|
198 |
-
|
199 |
-
|
|
|
|
|
200 |
flo_file = write_flo(predicted_flow, "flofile.flo")
|
201 |
#write_jpeg(frames[100], f"input_image.jpg")
|
202 |
#res = warp_image(img1_batch, predicted_flow)
|
203 |
|
204 |
# define a transform to convert a tensor to PIL image
|
205 |
-
|
206 |
|
207 |
# convert the tensor to PIL image using above transform
|
208 |
-
|
209 |
|
210 |
# display the PIL image
|
211 |
#img.show()
|
212 |
-
|
213 |
#res = get_warp_res("frame_input.jpg", predicted_flow, fname_output='warped.png')
|
214 |
#print(res)
|
215 |
return "done", "predicted_flow.jpg", ["flofile.flo"], 'frame_input.jpg'
|
|
|
195 |
flow_img = flow_to_image(predicted_flow).to("cpu")
|
196 |
# output_folder = "/tmp/" # Update this to the folder of your choice
|
197 |
write_jpeg(flow_img, f"predicted_flow.jpg")
|
198 |
+
|
199 |
+
#input_image = flow_to_image(frames[100]).to("cpu")
|
200 |
+
#write_jpeg(input_image, f"frame_input.jpg")
|
201 |
+
|
202 |
flo_file = write_flo(predicted_flow, "flofile.flo")
|
203 |
#write_jpeg(frames[100], f"input_image.jpg")
|
204 |
#res = warp_image(img1_batch, predicted_flow)
|
205 |
|
206 |
# define a transform to convert a tensor to PIL image
|
207 |
+
transform = T.ToPILImage()
|
208 |
|
209 |
# convert the tensor to PIL image using above transform
|
210 |
+
img = transform(img1_batch)
|
211 |
|
212 |
# display the PIL image
|
213 |
#img.show()
|
214 |
+
img.save('frame_input.jpg')
|
215 |
#res = get_warp_res("frame_input.jpg", predicted_flow, fname_output='warped.png')
|
216 |
#print(res)
|
217 |
return "done", "predicted_flow.jpg", ["flofile.flo"], 'frame_input.jpg'
|