Upload 2 files
Browse files- func/rife.py +33 -0
- install/rife.sh +13 -0
func/rife.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import time
|
3 |
+
import subprocess
|
4 |
+
import tempfile
|
5 |
+
import base64
|
6 |
+
import gc
|
7 |
+
|
8 |
+
from onegai.config import cfg
|
9 |
+
|
10 |
+
app_name = os.path.splitext(os.path.basename(__file__))[0]
|
11 |
+
|
12 |
+
def main(args):
|
13 |
+
return base64.b64encode(raw(args)), {}
|
14 |
+
|
15 |
+
def raw(args):
|
16 |
+
return generate(args['exp'], args['fps'])
|
17 |
+
|
18 |
+
def generate(exp, fps):
|
19 |
+
cd = 'cd ./apps/ECCV2022-RIFE/;'
|
20 |
+
python = ' ./venv/bin/python'
|
21 |
+
py = './inference_video.py'
|
22 |
+
options = f"--exp={exp} --fps={fps} --video={f.name}"
|
23 |
+
f = tempfile.NamedTemporaryFile(delete=False)
|
24 |
+
f.close()
|
25 |
+
cmd = f"{cd} {python} {py} {options}"
|
26 |
+
subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
27 |
+
|
28 |
+
f = open(f.name, 'rb')
|
29 |
+
content = f.read()
|
30 |
+
f.close()
|
31 |
+
os.unlink(f.name)
|
32 |
+
|
33 |
+
return content
|
install/rife.sh
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/bash
|
2 |
+
|
3 |
+
git clone https://github.com/megvii-research/ECCV2022-RIFE rife
|
4 |
+
cd rife
|
5 |
+
|
6 |
+
python3 -m venv venv
|
7 |
+
curl -kL https://bootstrap.pypa.io/get-pip.py | venv/bin/python
|
8 |
+
|
9 |
+
venv/bin/python -m pip install -r requirements.txt
|
10 |
+
venv/bin/python -m pip install sk-video moviepy opencv-python
|
11 |
+
|
12 |
+
wget https://huggingface.co/aka7774/ECCV2022-RIFE/resolve/main/RIFE_trained_model_v3.6.zip
|
13 |
+
unzip -o RIFE_trained_model_v3.6.zip
|