hr16 commited on
Commit
36bec38
·
1 Parent(s): 6788293

Update due to my update on the model repo

Browse files
Files changed (1) hide show
  1. app.py +14 -4
app.py CHANGED
@@ -79,8 +79,8 @@ def generate_images(G, args):
79
 
80
  #----------------------------------------------------------------------------
81
 
82
- def inference(seed, truncation_psi):
83
- G = stylegan2.models.load(hf_hub_download("hr16/Gwern-TWDNEv3-pytorch_ckpt", "Gs.pth", use_auth_token=os.environ['MODEL_READING_TOKEN']))
84
  G.eval()
85
  return generate_images(
86
  G,
@@ -100,8 +100,18 @@ article = ""
100
  gr.Interface(
101
  inference,
102
  [
103
- gr.Number(precision=0, label="Seed (any-bit-size unsigned int)"),
104
- gr.Slider(0, 2, step=0.1, value=0.7, label='Truncation psi (aka creative level, between 0 and 2)')
 
 
 
 
 
 
 
 
 
 
105
  ],
106
  gr.outputs.Image(type="pil"),
107
  title=title,description=description,article=article,allow_flagging=False,allow_screenshot=False
 
79
 
80
  #----------------------------------------------------------------------------
81
 
82
+ def inference(seed, truncation_psi, model_version):
83
+ G = stylegan2.models.load(hf_hub_download("hr16/Gwern-TWDNEv3-pytorch_ckpt", f"{model_version}/Gs.pth", use_auth_token=os.environ['MODEL_READING_TOKEN']))
84
  G.eval()
85
  return generate_images(
86
  G,
 
100
  gr.Interface(
101
  inference,
102
  [
103
+ gr.Number(precision=0, label="PCG64 PRNG Seed (any-bit-size unsigned int, note that it may different from the original site)"),
104
+ gr.Slider(0, 2, step=0.1, value=0.7, label='Truncation psi (aka creative level, between 0 and 2)'),
105
+ gr.Radio(
106
+ ["iteration-24664", "iteration-18528", "iteration-17325"],
107
+ value="iteration-24664",
108
+ type="value",
109
+ label=[
110
+ "TWDNEv3 iteration 24664 (best and current version on TWDNE)",
111
+ "TWDNEv3 iteration 18528 (the most used version on Internet)",
112
+ "TWDNEv3 iteration 17325"
113
+ ]
114
+ )
115
  ],
116
  gr.outputs.Image(type="pil"),
117
  title=title,description=description,article=article,allow_flagging=False,allow_screenshot=False