Kaushik066 commited on
Commit
46df290
·
1 Parent(s): 41a0f72

Update app_swin.py

Browse files
Files changed (1) hide show
  1. app_swin.py +1 -2
app_swin.py CHANGED
@@ -272,8 +272,7 @@ def save_video_to_mp4(video_tensor, fps=10):
272
  video_numpy = video_tensor.permute(0, 2, 3, 1).cpu().numpy()
273
  # Normalize values to [0, 255] if necessary
274
  if video_numpy.max() <= 1.0:
275
- #video_numpy = (video_numpy / 2 + 0.5).astype(np.uint8) # Unnormalize
276
- video_numpy = (video_numpy * 255).astype(np.uint8)
277
 
278
  # Create a temporary file to save the video
279
  temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".mp4")
 
272
  video_numpy = video_tensor.permute(0, 2, 3, 1).cpu().numpy()
273
  # Normalize values to [0, 255] if necessary
274
  if video_numpy.max() <= 1.0:
275
+ video_numpy = ((video_tensor + 1) / 2 * 255).astype(np.uint8) # Unnormalize
 
276
 
277
  # Create a temporary file to save the video
278
  temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".mp4")