Spaces:
Runtime error
Runtime error
harlanhong
commited on
Commit
·
c45e94d
1
Parent(s):
45a6699
first
Browse files- app.py +12 -1
- demo_dagan.py +1 -10
app.py
CHANGED
|
@@ -6,7 +6,18 @@ import subprocess
|
|
| 6 |
#os.chdir('Restormer')
|
| 7 |
from demo_dagan import *
|
| 8 |
# Download sample images
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
examples = [['project/cartoon2.jpg','project/video1.mp4'],
|
| 12 |
['project/cartoon3.jpg','project/video2.mp4'],
|
|
|
|
| 6 |
#os.chdir('Restormer')
|
| 7 |
from demo_dagan import *
|
| 8 |
# Download sample images
|
| 9 |
+
import torch
|
| 10 |
+
import torch.nn.functional as F
|
| 11 |
+
import os
|
| 12 |
+
from skimage import img_as_ubyte
|
| 13 |
+
import imageio
|
| 14 |
+
from skimage.transform import resize
|
| 15 |
+
import numpy as np
|
| 16 |
+
import modules.generator as G
|
| 17 |
+
import modules.keypoint_detector as KPD
|
| 18 |
+
import yaml
|
| 19 |
+
from collections import OrderedDict
|
| 20 |
+
import depth
|
| 21 |
|
| 22 |
examples = [['project/cartoon2.jpg','project/video1.mp4'],
|
| 23 |
['project/cartoon3.jpg','project/video2.mp4'],
|
demo_dagan.py
CHANGED
|
@@ -6,26 +6,17 @@
|
|
| 6 |
import torch
|
| 7 |
import torch.nn.functional as F
|
| 8 |
import os
|
| 9 |
-
from skimage import img_as_ubyte
|
| 10 |
-
import cv2
|
| 11 |
import argparse
|
| 12 |
-
import imageio
|
| 13 |
-
from skimage.transform import resize
|
| 14 |
from scipy.spatial import ConvexHull
|
| 15 |
from tqdm import tqdm
|
| 16 |
import numpy as np
|
| 17 |
-
import modules.generator as G
|
| 18 |
-
import modules.keypoint_detector as KPD
|
| 19 |
-
import yaml
|
| 20 |
-
from collections import OrderedDict
|
| 21 |
-
import depth
|
| 22 |
parser = argparse.ArgumentParser(description='Test DaGAN on your own images')
|
| 23 |
parser.add_argument('--source_image', default='./temp/source.jpg', type=str, help='Directory of input source image')
|
| 24 |
parser.add_argument('--driving_video', default='./temp/driving.mp4', type=str, help='Directory for driving video')
|
| 25 |
parser.add_argument('--output', default='./temp/result.mp4', type=str, help='Directory for driving video')
|
| 26 |
|
| 27 |
|
| 28 |
-
|
| 29 |
def normalize_kp(kp_source, kp_driving, kp_driving_initial, adapt_movement_scale=False,
|
| 30 |
use_relative_movement=False, use_relative_jacobian=False):
|
| 31 |
if adapt_movement_scale:
|
|
|
|
| 6 |
import torch
|
| 7 |
import torch.nn.functional as F
|
| 8 |
import os
|
|
|
|
|
|
|
| 9 |
import argparse
|
|
|
|
|
|
|
| 10 |
from scipy.spatial import ConvexHull
|
| 11 |
from tqdm import tqdm
|
| 12 |
import numpy as np
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
parser = argparse.ArgumentParser(description='Test DaGAN on your own images')
|
| 14 |
parser.add_argument('--source_image', default='./temp/source.jpg', type=str, help='Directory of input source image')
|
| 15 |
parser.add_argument('--driving_video', default='./temp/driving.mp4', type=str, help='Directory for driving video')
|
| 16 |
parser.add_argument('--output', default='./temp/result.mp4', type=str, help='Directory for driving video')
|
| 17 |
|
| 18 |
|
| 19 |
+
args = parser.parse_args()
|
| 20 |
def normalize_kp(kp_source, kp_driving, kp_driving_initial, adapt_movement_scale=False,
|
| 21 |
use_relative_movement=False, use_relative_jacobian=False):
|
| 22 |
if adapt_movement_scale:
|