Spaces:
Running
on
T4
Running
on
T4
Maitreyapatel
commited on
Commit
·
f8a9e77
1
Parent(s):
8e58b20
pixel diff bug resolved
Browse files
app.py
CHANGED
@@ -13,7 +13,7 @@ from attribution import MappingNetwork
|
|
13 |
|
14 |
import math
|
15 |
from typing import List
|
16 |
-
from PIL import Image
|
17 |
import numpy as np
|
18 |
import torch
|
19 |
|
@@ -79,9 +79,11 @@ class AttributionModel:
|
|
79 |
image_org = self.inference_without_attribution(out_latents)
|
80 |
image_org_pil = self.pipe.numpy_to_pil(image_org[0])
|
81 |
|
82 |
-
image_diff_pil = self.pipe.numpy_to_pil(image_attr[0] - image_org[0])
|
|
|
|
|
83 |
|
84 |
-
return image_org_pil[0], image_attr_pil[0], image_diff_pil
|
85 |
|
86 |
def inference_without_attribution(self, latents):
|
87 |
latents = 1 / 0.18215 * latents
|
|
|
13 |
|
14 |
import math
|
15 |
from typing import List
|
16 |
+
from PIL import Image, ImageChops
|
17 |
import numpy as np
|
18 |
import torch
|
19 |
|
|
|
79 |
image_org = self.inference_without_attribution(out_latents)
|
80 |
image_org_pil = self.pipe.numpy_to_pil(image_org[0])
|
81 |
|
82 |
+
# image_diff_pil = self.pipe.numpy_to_pil(image_attr[0] - image_org[0])
|
83 |
+
diff_factor = 5
|
84 |
+
image_diff_pil = ImageChops.difference(image_org_pil[0], image_attr_pil[0]).convert("RGB", (diff_factor,0,0,0,0,diff_factor,0,0,0,0,diff_factor,0))
|
85 |
|
86 |
+
return image_org_pil[0], image_attr_pil[0], image_diff_pil
|
87 |
|
88 |
def inference_without_attribution(self, latents):
|
89 |
latents = 1 / 0.18215 * latents
|