import gradio as gr import os import sys from pathlib import Path import time models =[ "", "CompVis/stable-diffusion-v1-4", "runwayml/stable-diffusion-v1-5", "prompthero/openjourney", "stabilityai/stable-diffusion-2-1", "stabilityai/stable-diffusion-2-1-base", "andite/anything-v4.0", "Linaqruf/anything-v3.0", "eimiss/EimisAnimeDiffusion_1.0v", "nitrosocke/Nitro-Diffusion", "wavymulder/portraitplus", "22h/vintedois-diffusion-v0-1", "dreamlike-art/dreamlike-photoreal-2.0", "dreamlike-art/dreamlike-diffusion-1.0", "wavymulder/Analog-Diffusion", "nitrosocke/redshift-diffusion", "claudfuen/photorealistic-fuen-v1", "prompthero/openjourney-v2", "johnslegers/epic-diffusion", "nitrosocke/Arcane-Diffusion", "darkstorm2150/Protogen_x5.8_Official_Release", ] model_1=models[1] model_2=models[2] model_3=models[3] model_4=models[4] model_5=models[5] model_6=models[6] model_7=models[7] model_8=models[8] model_9=models[9] model_10=models[10] model_11=models[11] model_12=models[12] model_13=models[13] model_14=models[14] model_15=models[15] model_16=models[16] model_17=models[17] model_18=models[18] model_19=models[19] model_20=models[20] text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion_link",live=True, preprocess=True) proc1=gr.Interface.load(f"models/{model_1}",live=False,preprocess=True, postprocess=False) proc2=gr.Interface.load(f"models/{model_2}",live=False,preprocess=True, postprocess=False) proc3=gr.Interface.load(f"models/{model_3}",live=False,preprocess=True, postprocess=False) proc4=gr.Interface.load(f"models/{model_4}",live=False,preprocess=True, postprocess=False) proc5=gr.Interface.load(f"models/{model_5}",live=False,preprocess=True, postprocess=False) proc6=gr.Interface.load(f"models/{model_6}",live=False,preprocess=True, postprocess=False) proc7=gr.Interface.load(f"models/{model_7}",live=False,preprocess=True, postprocess=False) proc8=gr.Interface.load(f"models/{model_8}",live=False,preprocess=True, postprocess=False) proc9=gr.Interface.load(f"models/{model_9}",live=False,preprocess=True, postprocess=False) proc10=gr.Interface.load(f"models/{model_10}",live=False,preprocess=True, postprocess=False) proc11=gr.Interface.load(f"models/{model_11}",live=False,preprocess=True, postprocess=False) proc12=gr.Interface.load(f"models/{model_12}",live=False,preprocess=True, postprocess=False) proc13=gr.Interface.load(f"models/{model_13}",live=False,preprocess=True, postprocess=False) proc14=gr.Interface.load(f"models/{model_14}",live=False,preprocess=True, postprocess=False) proc15=gr.Interface.load(f"models/{model_15}",live=False,preprocess=True, postprocess=False) proc16=gr.Interface.load(f"models/{model_16}",live=False,preprocess=True, postprocess=False) proc17=gr.Interface.load(f"models/{model_17}",live=False,preprocess=True, postprocess=False) proc18=gr.Interface.load(f"models/{model_18}",live=False,preprocess=True, postprocess=False) proc19=gr.Interface.load(f"models/{model_19}",live=False,preprocess=True, postprocess=False) proc20=gr.Interface.load(f"models/{model_20}",live=False,preprocess=True, postprocess=False) def get_prompts(prompt_text): return text_gen(prompt_text) def send_it1(inputs,proc1=proc1): output1=proc1(inputs) return(output1) def send_it2(inputs,proc2=proc2): output2=proc2(inputs) return(output2) def send_it3(inputs,proc3=proc3): output3=proc3(inputs) return(output3) def send_it4(inputs,proc4=proc4): output4=proc4(inputs) return(output4) def send_it5(inputs,proc5=proc5): output5=proc5(inputs) return(output5) def send_it6(inputs,proc6=proc6): output6=proc6(inputs) return(output6) def send_it7(inputs,proc7=proc7): output7=proc7(inputs) return(output7) def send_it8(inputs,proc8=proc8): output8=proc8(inputs) return(output8) def send_it9(inputs,proc9=proc9): output9=proc9(inputs) return(output9) def send_it10(inputs,proc10=proc10): output10=proc10(inputs) return(output10) def send_it11(inputs,proc11=proc11): output11=proc11(inputs) return(output11) def send_it12(inputs,proc12=proc12): output12=proc12(inputs) return(output12) def send_it13(inputs,proc13=proc13): output13=proc13(inputs) return(output13) def send_it14(inputs,proc14=proc14): output14=proc14(inputs) return(output14) def send_it15(inputs,proc15=proc15): output15=proc15(inputs) return(output15) def send_it16(inputs,proc16=proc16): output16=proc16(inputs) return(output16) def send_it17(inputs,proc17=proc17): output17=proc17(inputs) return(output17) def send_it18(inputs,proc18=proc18): output18=proc18(inputs) return(output18) def send_it19(inputs,proc19=proc19): output19=proc19(inputs) return(output19) def send_it20(inputs,proc20=proc20): output20=proc20(inputs) return(output20) with gr.Blocks(css="cake.css") as myface: gr.HTML("""""") with gr.Column(): gr.HTML("""Top 20 Diffuion""") gr.Markdown("""

Top 20 Diffusion

""") gr.Markdown("""

20 Popular Diffusion Models

""") gr.Markdown("""

Comparison Space

""") with gr.Accordion("Details",open=False): with gr.Tab("Description"): gr.Markdown("""

Enter your Prompt into the "Short Prompt" box and click "Magic Prompt" to load a prettified version of your prompt
When you are satisfied with the prompt that is in the "Text to Image" box, click "Launch" to load the Models.

Images load faster with a simpler prompt.

Images will cancel loading after 1 minute to preserve the quality of the queue.
Simply Click "Launch" again to try loading the incomplete images.
Page refreshes every 10 minutes.

Not responsible for content, use at your own risk.

""") with gr.Tab("DIY"): gr.HTML("""

Easy Clone:

Copy/Paste this code in your new app.py file

import gradio as gr
max_d=gr.Interface.load("spaces/Omnibus/Top-20-Diffusion")
max_d.launch()

""") with gr.Tab("Credits"): with gr.Row(): with gr.Column(style="text-align:left;"): gr.HTML(""" """) with gr.Column(style="text-align:left;"): gr.HTML(f""" """) with gr.Tab("Tools"): with gr.Tab("Draw"): with gr.Row(): with gr.Column(style="width=50%"): gr.Pil(label="Crop") with gr.Column(style="width=50%"): gr.Pil(label="Draw") with gr.Tab("View"): with gr.Row(): with gr.Column(): gr.Pil(label="Crop").style(style="height=500") with gr.Tab("Color Picker"): with gr.Row(): with gr.Column(scale=50): gr.ColorPicker(label="Color", interactive=True) with gr.Column(scale=50): gr.ImagePaint(label="Draw", interactive=True) with gr.Tab("Text"): with gr.Row(): with gr.Column(scale=50): gr.Textbox(label="", lines=8, interactive=True) with gr.Column(scale=50): gr.Textbox(label="", lines=8, interactive=True) with gr.Box(visible=True) as timo: with gr.Row(): with gr.Column(): input_text=gr.Textbox(label="Short Prompt") prompt=gr.Textbox(label="Text to Image",visible=True) with gr.Column(): see_prompts=gr.Button("Magic Prompt") with gr.Row(): run=gr.Button("Launch") clear_btn=gr.Button("Clear") with gr.Row(): output1=gr.Image(label=(f"{model_1}"),visible=True) output2=gr.Image(label=(f"{model_2}"),visible=True) output3=gr.Image(label=(f"{model_3}"),visible=True) output4=gr.Image(label=(f"{model_4}"),visible=True) with gr.Row(): output5=gr.Image(label=(f"{model_5}"),visible=True) output6=gr.Image(label=(f"{model_6}"),visible=True) output7=gr.Image(label=(f"{model_7}"),visible=True) output8=gr.Image(label=(f"{model_8}"),visible=True) with gr.Row(): output9=gr.Image(label=(f"{model_9}"),visible=True) output10=gr.Image(label=(f"{model_10}"),visible=True) output11=gr.Image(label=(f"{model_11}"),visible=True) output12=gr.Image(label=(f"{model_12}"),visible=True) with gr.Row(): output13=gr.Image(label=(f"{model_13}"),visible=True) output14=gr.Image(label=(f"{model_14}"),visible=True) output15=gr.Image(label=(f"{model_15}"),visible=True) output16=gr.Image(label=(f"{model_16}"),visible=True) with gr.Row(): output17=gr.Image(label=(f"{model_17}"),visible=True) output18=gr.Image(label=(f"{model_18}"),visible=True) output19=gr.Image(label=(f"{model_19}"),visible=True) output20=gr.Image(label=(f"{model_20}"),visible=True) with gr.Row(visible=False): start_box=gr.Number(interactive=False) end_box=gr.Number(interactive=False) tog_box=gr.Textbox(value=0,interactive=False) def clear_it(val): if int(val) != 0: val = 0 else: val = 0 pass return val def sesh_end(cnt,t_stamp): to = t_stamp + 60 et = time.time() if et > to and t_stamp != 0: d=gr.update(value=0) tog=gr.update(value=1) #print(f'to: {to} et: {et}') else: if cnt != 0: d=gr.update(value=et) else: d=gr.update(value=0) tog=gr.update(value=0) #print (f'passing: to: {to} et: {et}') pass return d,tog def sesh_start(): t = time.gmtime() t_stamp = time.time() current_time = time.strftime("%H:%M:%S", t) return gr.update(value=t_stamp),gr.update(value=t_stamp),gr.update(value=0) def clear_fn(): return None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None start_box.change(sesh_end,[start_box,end_box],[start_box,tog_box],every=1,show_progress=False) run.click(sesh_start,None,[start_box,end_box,tog_box]) run1=run.click(send_it1, inputs=[prompt], outputs=[output1]) run2=run.click(send_it2, inputs=[prompt], outputs=[output2]) run3=run.click(send_it3, inputs=[prompt], outputs=[output3]) run4=run.click(send_it4, inputs=[prompt], outputs=[output4]) run5=run.click(send_it5, inputs=[prompt], outputs=[output5]) run6=run.click(send_it6, inputs=[prompt], outputs=[output6]) run7=run.click(send_it7, inputs=[prompt], outputs=[output7]) run8=run.click(send_it8, inputs=[prompt], outputs=[output8]) run9=run.click(send_it9, inputs=[prompt], outputs=[output9]) run10=run.click(send_it10, inputs=[prompt], outputs=[output10]) run11=run.click(send_it11, inputs=[prompt], outputs=[output11]) run12=run.click(send_it12, inputs=[prompt], outputs=[output12]) run13=run.click(send_it13, inputs=[prompt], outputs=[output13]) run14=run.click(send_it14, inputs=[prompt], outputs=[output14]) run15=run.click(send_it15, inputs=[prompt], outputs=[output15]) run16=run.click(send_it16, inputs=[prompt], outputs=[output16]) run17=run.click(send_it17, inputs=[prompt], outputs=[output17]) run18=run.click(send_it18, inputs=[prompt], outputs=[output18]) run19=run.click(send_it19, inputs=[prompt], outputs=[output19]) run20=run.click(send_it20, inputs=[prompt], outputs=[output20]) prompt1=see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt],cancels=[run1,run2,run3,run4,run5,run6,run7,run8,run9,run10,run11,run12,run13,run14,run15,run16,run17,run18,run19,run20]) clear_btn.click(clear_fn, None, [input_text,prompt,output1,output2,output3,output4,output5,output6,output7,output8,output9,output10,output11,output12,output13,output14,output15,output16,output17,output18,output19,output20], cancels=[prompt1,run1,run2,run3,run4,run5,run6,run7,run8,run9,run10,run11,run12,run13,run14,run15,run16,run17,run18,run19,run20]) tog_box.change(clear_it,tog_box,tog_box,cancels=[run1,run2,run3,run4,run5,run6,run7,run8,run9,run10,run11,run12,run13,run14,run15,run16,run17,run18,run19,run20,prompt1]) myface.queue(concurrency_count=600,status_update_rate=1) myface.launch(inline=True,show_api=False)