Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -30,7 +30,8 @@ from modules.denormalize import denormalize_bin, denormalize_tr, denormalize_ar
|
|
30 |
|
31 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
32 |
|
33 |
-
|
|
|
34 |
# Extract parameters specific to GumbelVQ
|
35 |
vq_params = config.model.params
|
36 |
# Initialize the GumbelVQ models
|
@@ -70,7 +71,6 @@ def gen_sources(deepfake_img):
|
|
70 |
# Convert segmented numpy array (BGR) back to PIL Image
|
71 |
deepfake_seg = Image.fromarray(cv2.cvtColor(segmented_np, cv2.COLOR_BGR2RGB))
|
72 |
#------------Initialize:Decoder-F------------------------
|
73 |
-
config_path = "./models/config.yaml"
|
74 |
checkpoint_path_f = "./models/model_vaq1_ff.pth"
|
75 |
# Load model checkpoints
|
76 |
checkpoint_f = torch.load(self.checkpoint_path_f, map_location=self.device)
|
|
|
30 |
|
31 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
32 |
|
33 |
+
config_path = "./models/config.yaml"
|
34 |
+
config = OmegaConf.load(config_path)
|
35 |
# Extract parameters specific to GumbelVQ
|
36 |
vq_params = config.model.params
|
37 |
# Initialize the GumbelVQ models
|
|
|
71 |
# Convert segmented numpy array (BGR) back to PIL Image
|
72 |
deepfake_seg = Image.fromarray(cv2.cvtColor(segmented_np, cv2.COLOR_BGR2RGB))
|
73 |
#------------Initialize:Decoder-F------------------------
|
|
|
74 |
checkpoint_path_f = "./models/model_vaq1_ff.pth"
|
75 |
# Load model checkpoints
|
76 |
checkpoint_f = torch.load(self.checkpoint_path_f, map_location=self.device)
|