Spaces:
Runtime error
Runtime error
bhadresh-savani
commited on
Commit
·
1258ca3
1
Parent(s):
c3ab4c2
Update app.py
Browse files
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 |
-
|
239 |
-
|
240 |
|
241 |
-
return
|
242 |
|
243 |
def generate_images(test_input):
|
244 |
test_input = load_image_infer(test_input)
|
245 |
-
prediction = generator(
|
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 |
|