Spaces:
Running
Running
''' | |
with gr.Tab('Single model'): | |
with gr.Column(scale=2): | |
model_choice2 = gr.Dropdown(models, label='Choose model', value=models[0]) | |
with gr.Group(): | |
txt_input2 = gr.Textbox(label='Your prompt:', value = preSetPrompt, lines=3, autofocus=1) | |
with gr.Accordion("Advanced", open=False, visible=True): | |
with gr.Row(): | |
neg_input2 = gr.Textbox(label='Negative prompt:', value=negPreSetPrompt, lines=1) | |
with gr.Row(): | |
width2 = gr.Slider(label="Width", info="If 0, the default value is used.", maximum=1216, step=32, value=0) | |
height2 = gr.Slider(label="Height", info="If 0, the default value is used.", maximum=1216, step=32, value=0) | |
with gr.Row(): | |
steps2 = gr.Slider(label="Number of inference steps", info="If 0, the default value is used.", maximum=100, step=1, value=0) | |
cfg2 = gr.Slider(label="Guidance scale", info="If 0, the default value is used.", maximum=30.0, step=0.1, value=0) | |
seed2 = gr.Slider(label="Seed", info="Randomize Seed if -1.", minimum=-1, maximum=MAX_SEED, step=1, value=-1) | |
seed_rand2 = gr.Button("Randomize Seed", size="sm", variant="secondary") | |
seed_rand2.click(randomize_seed, None, [seed2], queue=False) | |
num_images = gr.Slider(1, max_images, value=max_images, step=1, label='Number of images') | |
with gr.Row(): | |
gen_button2 = gr.Button('Let the machine halucinate', variant='primary', scale=2, elem_classes=["butt"]) | |
with gr.Column(scale=1): | |
with gr.Group(): | |
with gr.Row(): | |
output2 = [gr.Image(label='', show_download_button=True, | |
interactive=False, width=112, height=112, visible=True, format="png", | |
show_share_button=False, show_label=False) for _ in range(max_images)] | |
for i, o in enumerate(output2): | |
img_i = gr.Number(i, visible=False) | |
num_images.change(lambda i, n: gr.update(visible = (i < n)), [img_i, num_images], o, queue=False) | |
gen_event2 = gr.on(triggers=[gen_button2.click, txt_input2.submit], | |
fn=lambda i, n, m, t1, t2, n1, n2, n3, n4, n5: gen_fn(m, t1, t2, n1, n2, n3, n4, n5) if (i < n) else None, | |
inputs=[img_i, num_images, model_choice2, txt_input2, neg_input2, | |
height2, width2, steps2, cfg2, seed2], outputs=[o], | |
concurrency_limit=None, queue=False) | |
''' |