Spaces:
Paused
Paused
Download tests/test_cli.py from nekab13477/DeepFakeAI: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/spaces/nekab13477/DeepFakeAI/resolve/main/tests/test_cli.py
- Command line
-
hf download hf://spaces/nekab13477/DeepFakeAI/tests/test_cli.py
-
curl -L -o test_cli.py https://huggingface.co/spaces/nekab13477/DeepFakeAI/resolve/main/tests/test_cli.py
1.26 kB
| import subprocess | |
| import pytest | |
| from DeepFakeAI import wording | |
| from DeepFakeAI.utilities import conditional_download | |
| def before_all() -> None: | |
| conditional_download('.assets/examples', | |
| [ | |
| 'https://github.com/DeepFakeAI/DeepFakeAI-assets/releases/download/examples/source.jpg', | |
| 'https://github.com/DeepFakeAI/DeepFakeAI-assets/releases/download/examples/target-1080p.mp4' | |
| ]) | |
| subprocess.run([ 'ffmpeg', '-i', '.assets/examples/target-1080p.mp4', '-vframes', '1', '.assets/examples/target-1080p.jpg' ]) | |
| def test_image_to_image() -> None: | |
| commands = [ 'python', 'run.py', '-s', '.assets/examples/source.jpg', '-t', '.assets/examples/target-1080p.jpg', '-o', '.assets/examples' ] | |
| run = subprocess.run(commands, stdout = subprocess.PIPE) | |
| assert run.returncode == 0 | |
| assert wording.get('processing_image_succeed') in run.stdout.decode() | |
| def test_image_to_video() -> None: | |
| commands = [ 'python', 'run.py', '-s', '.assets/examples/source.jpg', '-t', '.assets/examples/target-1080p.mp4', '-o', '.assets/examples', '--trim-frame-end', '10' ] | |
| run = subprocess.run(commands, stdout = subprocess.PIPE) | |
| assert run.returncode == 0 | |
| assert wording.get('processing_video_succeed') in run.stdout.decode() | |