import gradio as gr import os import sys model = ["dreamlike-art/dreamlike-diffusion-1.0"] proc1 = gr.Interface.load(f"models/{model[0]}", live=True, postprocess=True, preprocess=True) proc2 = gr.Interface.load("spaces/phenomenon1981/MagicPrompt-Stable-Diffusion") proc3 = gr.Interface.load("spaces/phenomenon1981/MagicPrompt-Stable-Diffusion") proc4 = gr.Interface.load("spaces/phenomenon1981/MagicPrompt-Stable-Diffusion") proc5 = gr.Interface.load("spaces/phenomenon1981/MagicPrompt-Stable-Diffusion") proc5 = gr.Interface.load("spaces/phenomenon1981/MagicPrompt-Stable-Diffusion") proc6 = gr.Interface.load("spaces/phenomenon1981/MagicPrompt-Stable-Diffusion") proc7 = gr.Interface.load("spaces/phenomenon1981/MagicPrompt-Stable-Diffusion") css = """""" with gr.Blocks(css=css) as sim: with gr.Row(): gr.HTML("""""") with gr.Row(): inputtext = gr.Textbox(label="Prompt Idea", placeholder="", lines=1) genbut = gr.Button("Generate Prompts") runbut = gr.Button("Generate Images", variant="primary") with gr.Row(): output1 = gr.Image(label="") output2 = gr.Image(label="") output3 = gr.Image(label="") with gr.Row(): gentext1 = gr.Textbox(label="Generated Prompt", lines=2) gentext2 = gr.Textbox(label="Generated Prompt", lines=2) gentext3 = gr.Textbox(label="Generated Prompt", lines=2) with gr.Row(): output4 = gr.Image(label="") output5 = gr.Image(label="") output6 = gr.Image(label="") with gr.Row(): gentext4 = gr.Textbox(label="Generated Prompt", lines=2) gentext5 = gr.Textbox(label="Generated Prompt", lines=2) gentext6 = gr.Textbox(label="Generated Prompt", lines=2) genbut.click(proc2, inputs=inputtext, outputs=gentext1) genbut.click(proc3, inputs=inputtext, outputs=gentext2) genbut.click(proc4, inputs=inputtext, outputs=gentext3) genbut.click(proc5, inputs=inputtext, outputs=gentext4) genbut.click(proc6, inputs=inputtext, outputs=gentext5) genbut.click(proc7, inputs=inputtext, outputs=gentext6) runbut.click(proc1, inputs=gentext1, outputs=output1) runbut.click(proc1, inputs=gentext2, outputs=output2) runbut.click(proc1, inputs=gentext3, outputs=output3) runbut.click(proc1, inputs=gentext4, outputs=output4) runbut.click(proc1, inputs=gentext5, outputs=output5) runbut.click(proc1, inputs=gentext6, outputs=output6) sim.queue(concurrency_count=200) sim.launch(inline=True, max_threads=400)