bhadresh-savani commited on
Commit
1258ca3
1 Parent(s): c3ab4c2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import gradio as gr
2
  import matplotlib.pyplot as plt
3
-
4
  import torch.nn as nn
5
  import torch.nn.functional as F
6
  import torch
@@ -235,14 +235,14 @@ class GeneratorUNet(nn.Module, HugGANModelHubMixin):
235
  return self.final(u7)
236
 
237
  def load_image_infer(image_file):
238
- imageA = Image.fromarray(np.array(imageA)[:, ::-1, :], "RGB")
239
- input_image = normalize_test(input_image)
240
 
241
- return input_image
242
 
243
  def generate_images(test_input):
244
  test_input = load_image_infer(test_input)
245
- prediction = generator(np.expand_dims(test_input, axis=0), training=True)
246
  fig = plt.figure(figsize=(128, 128))
247
  title = ['Predicted Image']
248
 
 
1
  import gradio as gr
2
  import matplotlib.pyplot as plt
3
+ from PIL import Image
4
  import torch.nn as nn
5
  import torch.nn.functional as F
6
  import torch
 
235
  return self.final(u7)
236
 
237
  def load_image_infer(image_file):
238
+ image_file = Image.fromarray(np.array(image_file)[:, ::-1, :], "RGB")
239
+ image_file = normalize_test(image_file)
240
 
241
+ return image_file
242
 
243
  def generate_images(test_input):
244
  test_input = load_image_infer(test_input)
245
+ prediction = generator(test_input).data
246
  fig = plt.figure(figsize=(128, 128))
247
  title = ['Predicted Image']
248