Spaces:
Build error
Build error
秋山翔
commited on
Commit
·
7b10f82
1
Parent(s):
76ea7e0
MAINT: formatting
Browse files
app.py
CHANGED
|
@@ -1,13 +1,10 @@
|
|
| 1 |
import os
|
| 2 |
-
|
| 3 |
-
os.system("pip install gradio==2.4.6")
|
| 4 |
import torch
|
| 5 |
import gradio as gr
|
| 6 |
import numpy as np
|
| 7 |
-
import torchvision.utils as vutils
|
| 8 |
import torchvision.transforms as transforms
|
| 9 |
|
| 10 |
-
|
| 11 |
from torch.autograd import Variable
|
| 12 |
from network.Transformer import Transformer
|
| 13 |
|
|
@@ -45,7 +42,7 @@ def inference(img):
|
|
| 45 |
output_image = output_image[[2, 1, 0], :, :]
|
| 46 |
output_image = output_image.data.cpu().float() * 0.5 + 0.5
|
| 47 |
|
| 48 |
-
return output_image
|
| 49 |
|
| 50 |
|
| 51 |
title = "Anime Background GAN"
|
|
@@ -65,7 +62,7 @@ gr.Interface(
|
|
| 65 |
title=title,
|
| 66 |
description=description,
|
| 67 |
article=article,
|
| 68 |
-
examples=
|
| 69 |
allow_flagging=False,
|
| 70 |
allow_screenshot=False,
|
| 71 |
enable_queue=True,
|
|
|
|
| 1 |
import os
|
|
|
|
|
|
|
| 2 |
import torch
|
| 3 |
import gradio as gr
|
| 4 |
import numpy as np
|
|
|
|
| 5 |
import torchvision.transforms as transforms
|
| 6 |
|
| 7 |
+
|
| 8 |
from torch.autograd import Variable
|
| 9 |
from network.Transformer import Transformer
|
| 10 |
|
|
|
|
| 42 |
output_image = output_image[[2, 1, 0], :, :]
|
| 43 |
output_image = output_image.data.cpu().float() * 0.5 + 0.5
|
| 44 |
|
| 45 |
+
return transforms.ToPILImage()(output_image)
|
| 46 |
|
| 47 |
|
| 48 |
title = "Anime Background GAN"
|
|
|
|
| 62 |
title=title,
|
| 63 |
description=description,
|
| 64 |
article=article,
|
| 65 |
+
examples=examples,
|
| 66 |
allow_flagging=False,
|
| 67 |
allow_screenshot=False,
|
| 68 |
enable_queue=True,
|