hr16 commited on
Commit
0c01bda
·
1 Parent(s): ff2b644

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -12,6 +12,7 @@ import gradio as gr
12
 
13
  from types import SimpleNamespace
14
 
 
15
  def generate_images(G, args):
16
  latent_size, label_size = G.latent_size, G.label_size
17
  device = torch.device(args.gpu[0] if args.gpu else 'cpu')
@@ -83,13 +84,13 @@ def inference(seed):
83
  return generate_images(
84
  G,
85
  SimpleNamespace(**{
86
- 'truncation_psi': 0.7, #It seems like 0.7 will give the best result.
87
  'seeds': [seed],
88
  'batch_size': 1,
89
  'pixel_min': -1,
90
  'pixel_max': 1,
91
  }) #https://github.com/adriansahlman/stylegan2_pytorch/blob/master/run_generator.py
92
- )
93
 
94
  title = "TWDNEv3 CPU Generator"
95
  description = "Gradio Demo for TWDNEv3 CPU Generator (stylegan2_pytorch port). To use it, simply put your random seed."
 
12
 
13
  from types import SimpleNamespace
14
 
15
+ #Edited from run_generator.py to return PIL images instead of saving them to the disk.
16
  def generate_images(G, args):
17
  latent_size, label_size = G.latent_size, G.label_size
18
  device = torch.device(args.gpu[0] if args.gpu else 'cpu')
 
84
  return generate_images(
85
  G,
86
  SimpleNamespace(**{
87
+ 'truncation_psi': 0.7, #It seems like 0.7 will give the best result for this model.
88
  'seeds': [seed],
89
  'batch_size': 1,
90
  'pixel_min': -1,
91
  'pixel_max': 1,
92
  }) #https://github.com/adriansahlman/stylegan2_pytorch/blob/master/run_generator.py
93
+ )[0]
94
 
95
  title = "TWDNEv3 CPU Generator"
96
  description = "Gradio Demo for TWDNEv3 CPU Generator (stylegan2_pytorch port). To use it, simply put your random seed."