ccxccc commited on
Update app.py
Browse files21 unmodified lines222324252627283 unmodified lines323334353637383940414 unmodified lines46474849505152532 unmodified lines5657585960616221 unmodified linesdef update_image_boxes(choices):extended_choices = extend_choices(choices)return [gr.Image(label=model, visible=(model != 'NA')).style(padding="10px", border_radius="10px", box_shadow="0px 5px 20px rgba(0, 0, 0, 0.1)", transition="transform 0.3s ease-in-out") for model in extended_choices]def generate_image(model_name, prompt):if model_name == 'NA':3 unmodified linesreturn models_load[model_name](prompt)with gr.Blocks() as demo:with gr.Tab("The Dream").style(padding="20px", border_radius="15px", box_shadow="0px 10px 40px rgba(0, 0, 0, 0.1)", transition="transform 0.3s ease-in-out"):txt_input = gr.Textbox(label="Your prompt:", lines=4).style(container=False, min_width=1200, border="2px solid #ccc", border_radius="10px", padding="10px", box_shadow="0px 3px 10px rgba(0, 0, 0, 0.1)")gen_button = gr.Button("Generate up to 6 images").style(background="#4CAF50", color="white", padding="10px 20px", border="none", border_radius="5px", cursor="pointer", transition="background 0.3s ease-in-out")stop_button = gr.Button("Stop", variant="secondary").style(background="#f44336", color="white", padding="10px 20px", border="none", border_radius="5px", cursor="pointer", transition="background 0.3s ease-in-out")gen_button.click(lambda _: gr.update(interactive=True), None, stop_button)with gr.Row():4 unmodified linesgen_event = gen_button.click(generate_image, [model_textbox, txt_input], output_image)stop_button.click(lambda _: gr.update(interactive=False), None, stop_button, cancels=[gen_event])with gr.Accordion("Model selection").style(padding="20px", border_radius="10px", box_shadow="0px 5px 20px rgba(0, 0, 0, 0.1)", transition="transform 0.3s ease-in-out"):model_choice = gr.CheckboxGroup(choices=models, label=f"Choose up to {num_models} models from the 686 available!", value=default_models, multiselect=True, max_choices=num_models, interactive=True).style(margin="10px 0", padding="10px", border_radius="5px", background="#f9f9f9", box_shadow="0px 3px 10px rgba(0, 0, 0, 0.1)")model_choice.change(update_image_boxes, model_choice, output_images)model_choice.change(lambda choices: extend_choices(choices, num_models), model_choice, model_textboxes)2 unmodified lines<div class="footer"><p>Based on spaces by derwahnsinn, RdnUser77, and the Omnibus Maximum Multiplier!</p></div>""").style(text_align="center", margin="20px 0")demo.queue(concurrency_count=200)demo.launch()21 unmodified lines222324252627283 unmodified lines323334353637383940414 unmodified lines46474849505152532 unmodified lines5657585960616221 unmodified linesdef update_image_boxes(choices):extended_choices = extend_choices(choices)return [gr.Image(label=model, visible=(model != 'NA')) for model in extended_choices]def generate_image(model_name, prompt):if model_name == 'NA':3 unmodified linesreturn models_load[model_name](prompt)with gr.Blocks() as demo:with gr.Tab("The Dream"):txt_input = gr.Textbox(label="Your prompt:", lines=4).style(container=False, min_width=1200)gen_button = gr.Button("Generate up to 6 images")stop_button = gr.Button("Stop", variant="secondary")gen_button.click(lambda _: gr.update(interactive=True), None, stop_button)with gr.Row():4 unmodified linesgen_event = gen_button.click(generate_image, [model_textbox, txt_input], output_image)stop_button.click(lambda _: gr.update(interactive=False), None, stop_button, cancels=[gen_event])with gr.Accordion("Model selection"):model_choice = gr.CheckboxGroup(choices=models, label=f"Choose up to {num_models} models from the 686 available!", value=default_models, multiselect=True, max_choices=num_models, interactive=True)model_choice.change(update_image_boxes, model_choice, output_images)model_choice.change(lambda choices: extend_choices(choices, num_models), model_choice, model_textboxes)2 unmodified lines<div class="footer"><p>Based on spaces by derwahnsinn, RdnUser77, and the Omnibus Maximum Multiplier!</p></div>""")demo.queue(concurrency_count=200)demo.launch()
app.py+8-8