akhaliq HF staff commited on
Commit
a524d62
1 Parent(s): 1b17e52

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -10,7 +10,6 @@ sys.path.append("projected_gan")
10
 
11
  """Generate images using pretrained network pickle."""
12
 
13
- import os
14
  import re
15
  from typing import List, Optional, Tuple, Union
16
 
@@ -22,6 +21,8 @@ import torch
22
 
23
  import legacy
24
 
 
 
25
  #----------------------------------------------------------------------------
26
 
27
  def parse_range(s: Union[str, List]) -> List[int]:
@@ -69,7 +70,9 @@ def make_transform(translate: Tuple[float,float], angle: float):
69
  #----------------------------------------------------------------------------
70
 
71
  device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
72
- with dnnlib.util.open_url('https://s3.eu-central-1.amazonaws.com/avg-projects/projected_gan/models/pokemon.pkl') as f:
 
 
73
  G = legacy.load_network_pkl(f)['G_ema'].to(device) # type: ignore
74
 
75
  def generate_images(seeds):
@@ -121,6 +124,6 @@ description = "Gradio demo for Projected GANs Converge Faster, Pokemon. To use i
121
 
122
  article = "<p style='text-align: center'><a href='http://www.cvlibs.net/publications/Sauer2021NEURIPS.pdf' target='_blank'>Projected GANs Converge Faster</a> | <a href='https://github.com/autonomousvision/projected_gan' target='_blank'>Github Repo</p><center><img src='https://visitor-badge.glitch.me/badge?page_id=akhaliq_projected_gan' alt='visitor badge'></center>"
123
 
124
- gr.Interface(inference,gr.inputs.Slider(label="Seed",minimum=0, maximum=5000, step=1, default=0),"pil",title=title,description=description,article=article, examples=[
125
  [0],[1],[10],[20],[30],[42],[50],[60],[77],[102]
126
  ]).launch(enable_queue=True,cache_examples=True)
 
10
 
11
  """Generate images using pretrained network pickle."""
12
 
 
13
  import re
14
  from typing import List, Optional, Tuple, Union
15
 
 
21
 
22
  import legacy
23
 
24
+ from huggingface_hub import hf_hub_url
25
+
26
  #----------------------------------------------------------------------------
27
 
28
  def parse_range(s: Union[str, List]) -> List[int]:
 
70
  #----------------------------------------------------------------------------
71
 
72
  device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
73
+
74
+ config_file_url = hf_hub_url("autonomousvision/Projected_GAN_Pokemon", filename="pokemon.pkl")
75
+ with dnnlib.util.open_url(config_file_url) as f:
76
  G = legacy.load_network_pkl(f)['G_ema'].to(device) # type: ignore
77
 
78
  def generate_images(seeds):
 
124
 
125
  article = "<p style='text-align: center'><a href='http://www.cvlibs.net/publications/Sauer2021NEURIPS.pdf' target='_blank'>Projected GANs Converge Faster</a> | <a href='https://github.com/autonomousvision/projected_gan' target='_blank'>Github Repo</p><center><img src='https://visitor-badge.glitch.me/badge?page_id=akhaliq_projected_gan' alt='visitor badge'></center>"
126
 
127
+ gr.Interface(inference,gr.inputs.Slider(label="Seed",minimum=0, maximum=1000, step=1, default=0),"pil",title=title,description=description,article=article, examples=[
128
  [0],[1],[10],[20],[30],[42],[50],[60],[77],[102]
129
  ]).launch(enable_queue=True,cache_examples=True)