3v324v23 commited on
Commit
4498d9d
1 Parent(s): bc1258a

Add more stuff

Browse files
Files changed (4) hide show
  1. .gitmodules +3 -0
  2. animate.py +2 -6
  3. app.py +4 -3
  4. frame_interpolation +1 -0
.gitmodules ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ [submodule "frame_interpolation"]
2
+ path = frame_interpolation
3
+ url = https://github.com/google-research/frame-interpolation
animate.py CHANGED
@@ -4,17 +4,13 @@ import sys
4
  import cv2
5
  import mediapy
6
  import numpy as np
7
- from eval import interpolator, util
8
  from huggingface_hub import snapshot_download
9
  from image_tools.sizes import resize_and_crop
10
  from moviepy.editor import CompositeVideoClip
11
  from moviepy.editor import VideoFileClip as vfc
12
  from PIL import Image
13
 
14
- # My installs
15
- os.system("git clone https://github.com/google-research/frame-interpolation")
16
- sys.path.append("frame-interpolation")
17
-
18
 
19
  # get key positions at which frame needs to be generated
20
  def list_of_positions(num_contours, num_frames=100):
@@ -164,7 +160,7 @@ def resize(width, img):
164
  return img
165
 
166
 
167
- def resize_img(cv2_images[0], cv2_images[1]):
168
  img_target_size = Image.open(cv2_images[0])
169
  img_to_resize = resize_and_crop(
170
  cv2_images[1],
 
4
  import cv2
5
  import mediapy
6
  import numpy as np
7
+ from frame_interpolation.eval import interpolator, util
8
  from huggingface_hub import snapshot_download
9
  from image_tools.sizes import resize_and_crop
10
  from moviepy.editor import CompositeVideoClip
11
  from moviepy.editor import VideoFileClip as vfc
12
  from PIL import Image
13
 
 
 
 
 
14
 
15
  # get key positions at which frame needs to be generated
16
  def list_of_positions(num_contours, num_frames=100):
 
160
  return img
161
 
162
 
163
+ def resize_img(img1, img2):
164
  img_target_size = Image.open(cv2_images[0])
165
  img_to_resize = resize_and_crop(
166
  cv2_images[1],
app.py CHANGED
@@ -3,11 +3,12 @@ import shutil
3
  import subprocess
4
  import uuid
5
  from pathlib import Path
6
-
7
  from moviepy.editor import AudioFileClip
8
 
9
  from animate import create_mp4_with_audio, get_video_frames
10
 
 
11
  output_dir = Path("temp/").absolute()
12
  output_dir.mkdir(exist_ok=True, parents=True)
13
 
@@ -42,7 +43,7 @@ class SpotifyApi:
42
  assert mp3_path is not None
43
  return mp3_path
44
 
45
- def get_final_mp3(self) -> str | None:
46
  # Look in all the subdirectories of spotify for the mp3 file
47
  for root, dirs, files in os.walk(
48
  Path(self.spotify_directory / self.foldername).resolve()
@@ -115,4 +116,4 @@ iface = gr.Interface(
115
  )
116
 
117
 
118
- iface.launch()
 
3
  import subprocess
4
  import uuid
5
  from pathlib import Path
6
+ import gradio as gr
7
  from moviepy.editor import AudioFileClip
8
 
9
  from animate import create_mp4_with_audio, get_video_frames
10
 
11
+ # My installs
12
  output_dir = Path("temp/").absolute()
13
  output_dir.mkdir(exist_ok=True, parents=True)
14
 
 
43
  assert mp3_path is not None
44
  return mp3_path
45
 
46
+ def get_final_mp3(self):
47
  # Look in all the subdirectories of spotify for the mp3 file
48
  for root, dirs, files in os.walk(
49
  Path(self.spotify_directory / self.foldername).resolve()
 
116
  )
117
 
118
 
119
+ iface.launch(share=True)
frame_interpolation ADDED
@@ -0,0 +1 @@
 
 
1
+ Subproject commit e9031587b441d679e841b59ccc5407778ba5f493