Spaces:
Runtime error
Runtime error
add get_style_lists interface
Browse files
app.py
CHANGED
@@ -20,6 +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 |
|
24 |
# download checkpoints
|
25 |
from huggingface_hub import hf_hub_download
|
@@ -63,6 +64,9 @@ def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
|
|
63 |
seed = random.randint(0, MAX_SEED)
|
64 |
return seed
|
65 |
|
|
|
|
|
|
|
66 |
|
67 |
# def remove_tips():
|
68 |
# return gr.update(visible=False)
|
@@ -341,7 +345,7 @@ with gr.Blocks(css=css) as demo:
|
|
341 |
)
|
342 |
|
343 |
submit = gr.Button("Submit", variant="primary")
|
344 |
-
|
345 |
style = gr.Dropdown(label="Style template", choices=STYLE_NAMES, value=DEFAULT_STYLE_NAME)
|
346 |
|
347 |
# strength
|
@@ -427,6 +431,12 @@ with gr.Blocks(css=css) as demo:
|
|
427 |
],
|
428 |
outputs=output_image,
|
429 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
430 |
|
431 |
# gr.Examples(
|
432 |
# 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() -> list:
|
68 |
+
return STYLE_NAMES
|
69 |
+
|
70 |
|
71 |
# def remove_tips():
|
72 |
# return gr.update(visible=False)
|
|
|
345 |
)
|
346 |
|
347 |
submit = gr.Button("Submit", variant="primary")
|
348 |
+
style_list = 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
|
|
|
431 |
],
|
432 |
outputs=output_image,
|
433 |
)
|
434 |
+
|
435 |
+
style_list.input(
|
436 |
+
fn=get_style_lists,
|
437 |
+
outputs=style_lists,
|
438 |
+
queue=False,
|
439 |
+
)
|
440 |
|
441 |
# gr.Examples(
|
442 |
# examples=get_example(),
|