bhadresh-savani commited on
Commit
af30eea
1 Parent(s): 1a122d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import gradio as gr
 
2
  import matplotlib.pyplot as plt
3
  from PIL import Image
4
  import numpy as np
@@ -236,8 +237,16 @@ class GeneratorUNet(nn.Module, HugGANModelHubMixin):
236
  return self.final(u7)
237
 
238
  def load_image_infer(image_file):
 
 
 
 
 
 
 
 
239
  image_file = Image.fromarray(np.array(image_file)[:, ::-1, :], "RGB")
240
- image_file = normalize_test(image_file)
241
 
242
  return image_file
243
 
 
1
  import gradio as gr
2
+ from torchvision.transforms import Compose, Resize, ToTensor, Normalize,
3
  import matplotlib.pyplot as plt
4
  from PIL import Image
5
  import numpy as np
 
237
  return self.final(u7)
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
  image_file = Image.fromarray(np.array(image_file)[:, ::-1, :], "RGB")
249
+ image_file = transform(image_file)
250
 
251
  return image_file
252