Update
Browse files
app.py
CHANGED
|
@@ -7,23 +7,26 @@ import functools
|
|
| 7 |
import os
|
| 8 |
import sys
|
| 9 |
|
| 10 |
-
if os.environ.get('SYSTEM') == 'spaces':
|
| 11 |
-
os.system("sed -i '14,21d' StyleSwin/op/fused_act.py")
|
| 12 |
-
os.system("sed -i '12,19d' StyleSwin/op/upfirdn2d.py")
|
| 13 |
-
|
| 14 |
-
sys.path.insert(0, 'StyleSwin')
|
| 15 |
-
|
| 16 |
import gradio as gr
|
| 17 |
import huggingface_hub
|
| 18 |
import numpy as np
|
| 19 |
import PIL.Image
|
| 20 |
import torch
|
| 21 |
import torch.nn as nn
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
from models.generator import Generator
|
| 23 |
|
| 24 |
-
REPO_URL = 'https://github.com/microsoft/StyleSwin'
|
| 25 |
TITLE = 'microsoft/StyleSwin'
|
| 26 |
-
DESCRIPTION =
|
|
|
|
|
|
|
|
|
|
| 27 |
SAMPLE_IMAGE_DIR = 'https://huggingface.co/spaces/hysts/StyleSwin/resolve/main/samples'
|
| 28 |
ARTICLE = f'''## Generated images
|
| 29 |
### CelebA-HQ
|
|
@@ -38,6 +41,8 @@ ARTICLE = f'''## Generated images
|
|
| 38 |
- size: 256x256
|
| 39 |
- seed: 0-99
|
| 40 |

|
|
|
|
|
|
|
| 41 |
'''
|
| 42 |
|
| 43 |
TOKEN = os.environ['TOKEN']
|
|
|
|
| 7 |
import os
|
| 8 |
import sys
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
import gradio as gr
|
| 11 |
import huggingface_hub
|
| 12 |
import numpy as np
|
| 13 |
import PIL.Image
|
| 14 |
import torch
|
| 15 |
import torch.nn as nn
|
| 16 |
+
|
| 17 |
+
if os.environ.get('SYSTEM') == 'spaces':
|
| 18 |
+
os.system("sed -i '14,21d' StyleSwin/op/fused_act.py")
|
| 19 |
+
os.system("sed -i '12,19d' StyleSwin/op/upfirdn2d.py")
|
| 20 |
+
|
| 21 |
+
sys.path.insert(0, 'StyleSwin')
|
| 22 |
+
|
| 23 |
from models.generator import Generator
|
| 24 |
|
|
|
|
| 25 |
TITLE = 'microsoft/StyleSwin'
|
| 26 |
+
DESCRIPTION = '''This is an unofficial demo for https://github.com/microsoft/StyleSwin.
|
| 27 |
+
|
| 28 |
+
Expected execution time on Hugging Face Spaces: 3s (for 256x256 images), 7s (for 1024x1024 images)
|
| 29 |
+
'''
|
| 30 |
SAMPLE_IMAGE_DIR = 'https://huggingface.co/spaces/hysts/StyleSwin/resolve/main/samples'
|
| 31 |
ARTICLE = f'''## Generated images
|
| 32 |
### CelebA-HQ
|
|
|
|
| 41 |
- size: 256x256
|
| 42 |
- seed: 0-99
|
| 43 |

|
| 44 |
+
|
| 45 |
+
<center><img src="https://visitor-badge.glitch.me/badge?page_id=hysts.styleswin" alt="visitor badge"/></center>
|
| 46 |
'''
|
| 47 |
|
| 48 |
TOKEN = os.environ['TOKEN']
|