hysts HF staff commited on
Commit
c06a3d7
1 Parent(s): 700a67c
Files changed (1) hide show
  1. app.py +12 -10
app.py CHANGED
@@ -9,12 +9,6 @@ import pathlib
9
  import sys
10
  from typing import Callable
11
 
12
- if os.environ.get('SYSTEM') == 'spaces':
13
- os.system("sed -i '10,17d' DualStyleGAN/model/stylegan/op/fused_act.py")
14
- os.system("sed -i '10,17d' DualStyleGAN/model/stylegan/op/upfirdn2d.py")
15
-
16
- sys.path.insert(0, 'DualStyleGAN')
17
-
18
  import dlib
19
  import gradio as gr
20
  import huggingface_hub
@@ -23,19 +17,27 @@ import PIL.Image
23
  import torch
24
  import torch.nn as nn
25
  import torchvision.transforms as T
 
 
 
 
 
 
 
26
  from model.dualstylegan import DualStyleGAN
27
  from model.encoder.align_all_parallel import align_face
28
  from model.encoder.psp import pSp
29
 
30
- ORIGINAL_REPO_URL = 'https://github.com/williamyang1991/DualStyleGAN'
31
  TITLE = 'williamyang1991/DualStyleGAN'
32
- DESCRIPTION = f'''This is a demo for {ORIGINAL_REPO_URL}.
33
 
34
  ![overview](https://raw.githubusercontent.com/williamyang1991/DualStyleGAN/main/doc_images/overview.jpg)
35
 
36
  You can select style images for each style type from the tables below.
37
  The style image index should be in the following range:
38
  (cartoon: 0-316, caricature: 0-198, anime: 0-173, arcane: 0-99, comic: 0-100, pixar: 0-121, slamdunk: 0-119)
 
 
39
  '''
40
  ARTICLE = '''## Style images
41
 
@@ -61,6 +63,8 @@ Note that the style images here for Arcane, comic, Pixar, and Slamdunk are the r
61
 
62
  ### Slamdunk
63
  ![slamdunk style images](https://raw.githubusercontent.com/williamyang1991/DualStyleGAN/main/doc_images/Reconstruction_slamdunk_overview.jpg)
 
 
64
  '''
65
 
66
  TOKEN = os.environ['TOKEN']
@@ -217,8 +221,6 @@ def run(
217
 
218
 
219
  def main():
220
- gr.close_all()
221
-
222
  args = parse_args()
223
  device = torch.device(args.device)
224
 
 
9
  import sys
10
  from typing import Callable
11
 
 
 
 
 
 
 
12
  import dlib
13
  import gradio as gr
14
  import huggingface_hub
 
17
  import torch
18
  import torch.nn as nn
19
  import torchvision.transforms as T
20
+
21
+ if os.environ.get('SYSTEM') == 'spaces':
22
+ os.system("sed -i '10,17d' DualStyleGAN/model/stylegan/op/fused_act.py")
23
+ os.system("sed -i '10,17d' DualStyleGAN/model/stylegan/op/upfirdn2d.py")
24
+
25
+ sys.path.insert(0, 'DualStyleGAN')
26
+
27
  from model.dualstylegan import DualStyleGAN
28
  from model.encoder.align_all_parallel import align_face
29
  from model.encoder.psp import pSp
30
 
 
31
  TITLE = 'williamyang1991/DualStyleGAN'
32
+ DESCRIPTION = '''This is an unofficial demo for https://github.com/williamyang1991/DualStyleGAN.
33
 
34
  ![overview](https://raw.githubusercontent.com/williamyang1991/DualStyleGAN/main/doc_images/overview.jpg)
35
 
36
  You can select style images for each style type from the tables below.
37
  The style image index should be in the following range:
38
  (cartoon: 0-316, caricature: 0-198, anime: 0-173, arcane: 0-99, comic: 0-100, pixar: 0-121, slamdunk: 0-119)
39
+
40
+ Expected execution time on Hugging Face Spaces: 15s
41
  '''
42
  ARTICLE = '''## Style images
43
 
 
63
 
64
  ### Slamdunk
65
  ![slamdunk style images](https://raw.githubusercontent.com/williamyang1991/DualStyleGAN/main/doc_images/Reconstruction_slamdunk_overview.jpg)
66
+
67
+ <center><img src="https://visitor-badge.glitch.me/badge?page_id=hysts.dualstylegan" alt="visitor badge"/></center>
68
  '''
69
 
70
  TOKEN = os.environ['TOKEN']
 
221
 
222
 
223
  def main():
 
 
224
  args = parse_args()
225
  device = torch.device(args.device)
226