Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,35 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
with gr.Blocks(title="GAN Hub", theme="soft") as iface:
|
4 |
gr.Markdown("""
|
@@ -8,4 +39,4 @@ with gr.Blocks(title="GAN Hub", theme="soft") as iface:
|
|
8 |
""")
|
9 |
|
10 |
if __name__ == "__main__":
|
11 |
-
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
import torch
|
3 |
+
import torch.nn as nn
|
4 |
+
|
5 |
+
class Generator(nn.Module):
|
6 |
+
def __init__(self):
|
7 |
+
super(Generator, self).__init__()
|
8 |
+
self.main = nn.Sequential(
|
9 |
+
nn.ConvTranspose2d(nz, ngf * 8, 4, 1, 0, bias=False),
|
10 |
+
nn.BatchNorm2d(ngf * 8),
|
11 |
+
nn.LeakyReLU(0.2, inplace=True),
|
12 |
+
nn.Dropout(0.25),
|
13 |
+
|
14 |
+
nn.ConvTranspose2d(ngf * 8, ngf * 4, 4, 2, 1, bias=False),
|
15 |
+
nn.BatchNorm2d(ngf * 4),
|
16 |
+
nn.LeakyReLU(0.2, inplace=True),
|
17 |
+
|
18 |
+
nn.ConvTranspose2d(ngf * 4, ngf * 2, 4, 2, 1, bias=False),
|
19 |
+
nn.BatchNorm2d(ngf * 2),
|
20 |
+
nn.LeakyReLU(0.2, inplace=True),
|
21 |
+
|
22 |
+
nn.ConvTranspose2d(ngf * 2, ngf, 4, 2, 1, bias=False),
|
23 |
+
nn.BatchNorm2d(ngf),
|
24 |
+
nn.LeakyReLU(0.2, inplace=True),
|
25 |
+
|
26 |
+
nn.ConvTranspose2d(ngf, nc, 4, 2, 1, bias=False),
|
27 |
+
nn.Tanh()
|
28 |
+
)
|
29 |
+
|
30 |
+
def forward(self, input):
|
31 |
+
output = self.main(input)
|
32 |
+
return output
|
33 |
|
34 |
with gr.Blocks(title="GAN Hub", theme="soft") as iface:
|
35 |
gr.Markdown("""
|
|
|
39 |
""")
|
40 |
|
41 |
if __name__ == "__main__":
|
42 |
+
iface.queue().launch(show_api=False)
|