Spaces:
Running
Running
gokaygokay
commited on
Commit
•
14c21df
1
Parent(s):
b65ff3c
Update app.py
Browse files
app.py
CHANGED
@@ -394,7 +394,7 @@ def create_interface():
|
|
394 |
with gr.Row():
|
395 |
with gr.Column(scale=2):
|
396 |
with gr.Accordion("Basic Settings"):
|
397 |
-
seed = gr.Number(label="Seed", value
|
398 |
custom = gr.Textbox(label="Custom Input Prompt (optional)")
|
399 |
subject = gr.Textbox(label="Subject (optional)")
|
400 |
|
@@ -464,14 +464,22 @@ def create_interface():
|
|
464 |
outputs=[caption_output]
|
465 |
)
|
466 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
467 |
generate_button.click(
|
468 |
-
|
469 |
inputs=[seed, custom, subject, artform, photo_type, body_types, default_tags, roles, hairstyles,
|
470 |
additional_details, photography_styles, device, photographer, artist, digital_artform,
|
471 |
place, lighting, clothing, composition, pose, background],
|
472 |
outputs=[output, gr.Number(visible=False), t5xxl_output, clip_l_output, clip_g_output]
|
473 |
)
|
474 |
|
|
|
475 |
add_caption_button.click(
|
476 |
prompt_generator.add_caption_to_prompt,
|
477 |
inputs=[output, caption_output],
|
|
|
394 |
with gr.Row():
|
395 |
with gr.Column(scale=2):
|
396 |
with gr.Accordion("Basic Settings"):
|
397 |
+
seed = gr.Number(label="Seed", value=-1)
|
398 |
custom = gr.Textbox(label="Custom Input Prompt (optional)")
|
399 |
subject = gr.Textbox(label="Subject (optional)")
|
400 |
|
|
|
464 |
outputs=[caption_output]
|
465 |
)
|
466 |
|
467 |
+
def generate_prompt_with_random_seed(*args):
|
468 |
+
if args[0] == -1: # If seed is -1, use a random seed
|
469 |
+
random_seed = random.randint(0, 2**32 - 1)
|
470 |
+
args = list(args)
|
471 |
+
args[0] = random_seed
|
472 |
+
return prompt_generator.generate_prompt(*args)
|
473 |
+
|
474 |
generate_button.click(
|
475 |
+
generate_prompt_with_random_seed,
|
476 |
inputs=[seed, custom, subject, artform, photo_type, body_types, default_tags, roles, hairstyles,
|
477 |
additional_details, photography_styles, device, photographer, artist, digital_artform,
|
478 |
place, lighting, clothing, composition, pose, background],
|
479 |
outputs=[output, gr.Number(visible=False), t5xxl_output, clip_l_output, clip_g_output]
|
480 |
)
|
481 |
|
482 |
+
|
483 |
add_caption_button.click(
|
484 |
prompt_generator.add_caption_to_prompt,
|
485 |
inputs=[output, caption_output],
|