Staticaliza commited on
Commit
e8b05fb
·
verified ·
1 Parent(s): 4036c77

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -81,10 +81,10 @@ def build_image(path):
81
  return image
82
 
83
  def build_gif(path):
84
- vr = VideoReader(path, ctx=cpu(0))
85
- i = uniform_sample(range(len(vr)), MAX_FRAMES)
86
- frames = vr.get_batch(i).asnumpy()
87
- return [Image.fromarray(f.astype("uint8")) for f in frames]
88
 
89
  def build_audio(path):
90
  audio, _ = librosa.load(path, sr=AUDIO_SR, mono=True)
 
81
  return image
82
 
83
  def build_gif(path):
84
+ image = Image.open(path)
85
+ frames = [f.copy().convert("RGB") for f in ImageSequence.Iterator(image)]
86
+ frames = uniform_sample(frames, MAX_FRAMES)
87
+ return [*frames]
88
 
89
  def build_audio(path):
90
  audio, _ = librosa.load(path, sr=AUDIO_SR, mono=True)