fffiloni commited on
Commit
25e410d
1 Parent(s): d2307e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -35,13 +35,8 @@ def do_interpolation(frame1, frame2):
35
  input_frames, times_to_interpolate, interpolator))
36
 
37
  #print(frames)
38
- named_frames = []
39
- for idx, i in frames:
40
- i = Image.fromarray(np.uint8(i))
41
- i.save(f'{frame1}_{frame2}_{idx}.jpg')
42
- named_frame.append(f'{frame1}_{frame2}_{idx}.jpg')
43
- print(named_frames)
44
- return frames
45
 
46
  def get_frames(video_in):
47
  frames = []
@@ -118,7 +113,11 @@ def infer(video_in):
118
  if idx < len(frames_list) - 1:
119
  next_frame = frames_list[idx+1]
120
  interpolated_frames = do_interpolation(frame, next_frame) # should return a list of 3 interpolated frames
121
- result_frames.extend(interpolated_frames)
 
 
 
 
122
  print("frames " + str(idx) + " & " + str(idx+1) + "/" + str(n_frame) + ": done;")
123
 
124
  final_vid = create_video(result_frames, fps, "interpolated")
 
35
  input_frames, times_to_interpolate, interpolator))
36
 
37
  #print(frames)
38
+ mediapy.write_video(f"{frame1}_to_{frame2}_out.mp4", frames, fps=12)
39
+ return f"{frame1}_to_{frame2}_out.mp4"
 
 
 
 
 
40
 
41
  def get_frames(video_in):
42
  frames = []
 
113
  if idx < len(frames_list) - 1:
114
  next_frame = frames_list[idx+1]
115
  interpolated_frames = do_interpolation(frame, next_frame) # should return a list of 3 interpolated frames
116
+ break_interpolated_video = get_frames(interpolated_frames)[0]
117
+ for j, img in break_interpolated_video:
118
+ img = Image.open(img)
119
+ img = Image.save(f"{frame}_to_{next_frame}_{j}")
120
+ result_frames.append(img)
121
  print("frames " + str(idx) + " & " + str(idx+1) + "/" + str(n_frame) + ": done;")
122
 
123
  final_vid = create_video(result_frames, fps, "interpolated")