LPDoctor commited on
Commit
055f1da
·
verified ·
1 Parent(s): 40ddb0c

get style lists

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -20,7 +20,7 @@ MAX_SEED = np.iinfo(np.int32).max
20
  device = "cuda" if torch.cuda.is_available() else "cpu"
21
  STYLE_NAMES = list(styles.keys())
22
  DEFAULT_STYLE_NAME = "Watercolor"
23
- # open_template_lists = False
24
 
25
  # download checkpoints
26
  from huggingface_hub import hf_hub_download
@@ -64,8 +64,8 @@ def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
64
  seed = random.randint(0, MAX_SEED)
65
  return seed
66
 
67
- # def get_style_lists() -> list:
68
- # return gr.update(visible=False)
69
 
70
 
71
  # def remove_tips():
@@ -345,7 +345,7 @@ with gr.Blocks(css=css) as demo:
345
  )
346
 
347
  submit = gr.Button("Submit", variant="primary")
348
- # style_event = gr.Checkbox(label="display the style templates", value=open_template_lists)
349
  style = gr.Dropdown(label="Style template", choices=STYLE_NAMES, value=DEFAULT_STYLE_NAME)
350
 
351
  # strength
@@ -432,12 +432,11 @@ with gr.Blocks(css=css) as demo:
432
  outputs=output_image,
433
  )
434
 
435
- # style_event.input(
436
- # fn=get_style_lists,
437
- # inputs=None,
438
- # outputs=STYLE_NAMES,
439
- # queue=False,
440
- # )
441
 
442
  # gr.Examples(
443
  # examples=get_example(),
 
20
  device = "cuda" if torch.cuda.is_available() else "cpu"
21
  STYLE_NAMES = list(styles.keys())
22
  DEFAULT_STYLE_NAME = "Watercolor"
23
+ open_template_lists = False
24
 
25
  # download checkpoints
26
  from huggingface_hub import hf_hub_download
 
64
  seed = random.randint(0, MAX_SEED)
65
  return seed
66
 
67
+ def get_style_lists():
68
+ return gr.update(visible=False)
69
 
70
 
71
  # def remove_tips():
 
345
  )
346
 
347
  submit = gr.Button("Submit", variant="primary")
348
+ style_event = gr.Checkbox(label="display the style templates", value=open_template_lists)
349
  style = gr.Dropdown(label="Style template", choices=STYLE_NAMES, value=DEFAULT_STYLE_NAME)
350
 
351
  # strength
 
432
  outputs=output_image,
433
  )
434
 
435
+ style_event.input(
436
+ fn=get_style_lists,
437
+ outputs=STYLE_NAMES,
438
+ queue=False,
439
+ )
 
440
 
441
  # gr.Examples(
442
  # examples=get_example(),