| import os | |
| import time | |
| import subprocess | |
| import tempfile | |
| import base64 | |
| import gc | |
| from onegai.config import cfg | |
| app_name = os.path.splitext(os.path.basename(__file__))[0] | |
| def main(args): | |
| return base64.b64encode(raw(args)), {} | |
| def raw(args): | |
| return generate(args['exp'], args['fps']) | |
| def generate(exp, fps): | |
| cd = 'cd ./apps/ECCV2022-RIFE/;' | |
| python = ' ./venv/bin/python' | |
| py = './inference_video.py' | |
| options = f"--exp={exp} --fps={fps} --video={f.name}" | |
| f = tempfile.NamedTemporaryFile(delete=False) | |
| f.close() | |
| cmd = f"{cd} {python} {py} {options}" | |
| subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) | |
| f = open(f.name, 'rb') | |
| content = f.read() | |
| f.close() | |
| os.unlink(f.name) | |
| return content | |