Iceclear commited on
Commit
6571c22
·
verified ·
1 Parent(s): a164dea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -3
app.py CHANGED
@@ -322,7 +322,25 @@ def generation_loop(video_path='./test_videos', seed=666, fps_out=12, batch_size
322
  print(f"Read video size: {video.size()}")
323
  output_dir = 'output/' + str(uuid.uuid4()) + '.mp4'
324
  else:
325
- img = Image.open(input_file.name).convert("RGB")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326
  img_tensor = T.ToTensor()(img).unsqueeze(0) # (1, C, H, W)
327
  video = img_tensor.permute(0, 1, 2, 3) # (T=1, C, H, W)
328
  print(f"Read Image size: {video.size()}")
@@ -439,8 +457,8 @@ with gr.Blocks(title="SeedVR2: One-Step Video Restoration via Diffusion Adversar
439
  </a>
440
 
441
  <h4>Notice</h4>
442
- <p>This demo supports up to <b>720p</b> and <b>121 frames</b>.
443
- For other use cases (image restoration, video resolutions beyond 720p, etc), check the <a href='https://github.com/ByteDance-Seed/SeedVR' target='_blank'>GitHub repo</a>.</p>
444
 
445
  <h4>Limitations</h4>
446
  <p>May fail on heavy degradations or small-motion AIGC clips, causing oversharpening or poor restoration.</p>
 
322
  print(f"Read video size: {video.size()}")
323
  output_dir = 'output/' + str(uuid.uuid4()) + '.mp4'
324
  else:
325
+ video_transform = Compose(
326
+ [
327
+ NaResize(
328
+ resolution=(
329
+ 2560 * 1440
330
+ )
331
+ ** 0.5,
332
+ mode="area",
333
+ # Upsample image, model only trained for high res.
334
+ downsample_only=False,
335
+ ),
336
+ Lambda(lambda x: torch.clamp(x, 0.0, 1.0)),
337
+ DivisibleCrop((16, 16)),
338
+ Normalize(0.5, 0.5),
339
+ Rearrange("t c h w -> c t h w"),
340
+ ]
341
+ )
342
+
343
+ img = Image.open(video_path).convert("RGB")
344
  img_tensor = T.ToTensor()(img).unsqueeze(0) # (1, C, H, W)
345
  video = img_tensor.permute(0, 1, 2, 3) # (T=1, C, H, W)
346
  print(f"Read Image size: {video.size()}")
 
457
  </a>
458
 
459
  <h4>Notice</h4>
460
+ <p>This demo supports up to <b>720p and 121 frames for videos or 2k images</b>.
461
+ For other use cases (image restoration beyond 2K, video resolutions beyond 720p, etc), check the <a href='https://github.com/ByteDance-Seed/SeedVR' target='_blank'>GitHub repo</a>.</p>
462
 
463
  <h4>Limitations</h4>
464
  <p>May fail on heavy degradations or small-motion AIGC clips, causing oversharpening or poor restoration.</p>