Spaces:
Runtime error
Runtime error
Commit
·
608f555
1
Parent(s):
a55c1e5
Update app.py
Browse files
app.py
CHANGED
@@ -238,17 +238,15 @@ class GeneratorUNet(nn.Module, HugGANModelHubMixin):
|
|
238 |
|
239 |
def load_image_infer(image_file):
|
240 |
# Configure dataloaders
|
241 |
-
transform = Compose(
|
242 |
-
[
|
243 |
Resize((args.image_size, args.image_size), Image.BICUBIC),
|
244 |
ToTensor(),
|
245 |
Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)),
|
246 |
-
]
|
247 |
-
|
248 |
-
|
249 |
-
image_file = transform(image_file)
|
250 |
|
251 |
-
|
252 |
|
253 |
def generate_images(test_input):
|
254 |
test_input = load_image_infer(test_input)
|
|
|
238 |
|
239 |
def load_image_infer(image_file):
|
240 |
# Configure dataloaders
|
241 |
+
transform = Compose([
|
|
|
242 |
Resize((args.image_size, args.image_size), Image.BICUBIC),
|
243 |
ToTensor(),
|
244 |
Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)),
|
245 |
+
])
|
246 |
+
image_file = Image.fromarray(np.array(image_file)[:, ::-1, :], "RGB")
|
247 |
+
image_file = transform(image_file)
|
|
|
248 |
|
249 |
+
return image_file
|
250 |
|
251 |
def generate_images(test_input):
|
252 |
test_input = load_image_infer(test_input)
|