Spaces:
Runtime error
Runtime error
File size: 8,175 Bytes
b0a694d d7b584f b0a694d 6b15d84 b0a694d d7b584f 6b15d84 d7b584f b0a694d d7b584f b0a694d 019a8c2 3789798 b13ddff 019a8c2 b13ddff 57bed7e 223e7ef b13ddff b0a694d 57bed7e b0a694d 57bed7e d7b584f 57bed7e b0a694d 57bed7e b13ddff 57bed7e d7b584f 57bed7e b13ddff 57bed7e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | 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",
"SG161222/Realistic_Vision_V1.4",
"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",
]
current_model = models[5]
models2=[
gr.Interface.load(f"models/{models[1]}",live=True,preprocess=True),
gr.Interface.load(f"models/{models[2]}",live=True,preprocess=True),
gr.Interface.load(f"models/{models[3]}",live=True,preprocess=True),
gr.Interface.load(f"models/{models[4]}",live=True,preprocess=True),
gr.Interface.load(f"models/{models[5]}",live=True,preprocess=True),
gr.Interface.load(f"models/{models[6]}",live=True,preprocess=True),
gr.Interface.load(f"models/{models[7]}",live=True,preprocess=True),
gr.Interface.load(f"models/{models[8]}",live=True,preprocess=True),
gr.Interface.load(f"models/{models[9]}",live=True,preprocess=True),
gr.Interface.load(f"models/{models[10]}",live=True,preprocess=True),
gr.Interface.load(f"models/{models[11]}",live=True,preprocess=True),
gr.Interface.load(f"models/{models[12]}",live=True,preprocess=True),
gr.Interface.load(f"models/{models[13]}",live=True,preprocess=True),
gr.Interface.load(f"models/{models[14]}",live=True,preprocess=True),
gr.Interface.load(f"models/{models[15]}",live=True,preprocess=True),
gr.Interface.load(f"models/{models[16]}",live=True,preprocess=True),
gr.Interface.load(f"models/{models[17]}",live=True,preprocess=True),
gr.Interface.load(f"models/{models[18]}",live=True,preprocess=True),
gr.Interface.load(f"models/{models[19]}",live=True,preprocess=True),
gr.Interface.load(f"models/{models[20]}",live=True,preprocess=True),
]
text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion_link",live=True, preprocess=True)
def send_it1(inputs,model_choice=5, count = 1):
if model_choice==None:
model_choice=5
t=0
output_list=[]
while t<int(count):
proc1=models2[int(model_choice)]
output1=proc1(inputs)
output_list.append(output1)
inputs=f"{inputs} "
t+=1
return(output_list)
with gr.Blocks(css="cake.css") as myface:
gr.HTML("""<head><meta http-equiv="refresh" content="180"></head>""")
gr.HTML("""<title>Top 20 Diffuion</title>""")
with gr.Column():
gr.Markdown("""<center><h1>Top 20 Diffusion</h1><center>""")
with gr.Accordion("Details",open=False):
with gr.Tab("Description"):
gr.Markdown("""<center>
<h6>Enter your Prompt into the "Short Prompt" box and click "Magic Prompt" to load a prettified version of your prompt<br>
When you are satisfied with the prompt that is in the "Text to Image" box, click "Launch" to load the Models.<br><br>
Images load faster with a simpler prompt.<br>
<br>
Images will cancel loading after 1 minute to preserve the quality of the queue.<br>
Simply Click "Launch" again to try loading the incomplete images.<br>
Page refreshes every 3 minutes for this Demo.
<br>
<br>
Not responsible for content, use at your own risk.
</h6></center>""")
with gr.Tab("DIY"):
gr.HTML("""<div style="text-align:Left;">
<h6>Easy Clone:<br><br>
Copy/Paste this code in your new app.py file<br><br>
import gradio as gr<br>
max_d=gr.Interface.load("spaces/Omnibus/Top-20-Diffusion")<br>
max_d.launch()<br>
</h6></div>""")
with gr.Tab("Credits"):
with gr.Row():
with gr.Column(style="text-align:left;"):
gr.HTML("""
<div style="vertical-align:center">
<br>
<p>Magic Prompt:
<p><a href="https://huggingface.co/spaces/Gustavosta/MagicPrompt-Stable-Diffusion">Magic Prompt Stable Diffusion</a></p>
<p><a href="https://huggingface.co/spaces/huggingface-projects/magic-diffusion">Magic Diffusion</a></p>
</div>
""")
with gr.Column(style="text-align:left;"):
gr.HTML(f"""
<div style="vertical-align:center">
<br>
<p>Models by:<br>
<a href="https://huggingface.co/{models[1]}">{models[1]}</a><br>
<a href="https://huggingface.co/{models[2]}">{models[2]}</a><br>
<a href="https://huggingface.co/{models[3]}">{models[3]}</a><br>
<a href="https://huggingface.co/{models[4]}">{models[4]}</a><br>
<a href="https://huggingface.co/{models[5]}">{models[5]}</a><br>
<a href="https://huggingface.co/{models[6]}">{models[6]}</a><br>
<a href="https://huggingface.co/{models[7]}">{models[7]}</a><br>
<a href="https://huggingface.co/{models[8]}">{models[8]}</a><br>
<a href="https://huggingface.co/{models[9]}">{models[9]}</a><br>
<a href="https://huggingface.co/{models[10]}">{models[10]}</a><br>
<a href="https://huggingface.co/{models[11]}">{models[11]}</a><br>
<a href="https://huggingface.co/{models[12]}">{models[12]}</a><br>
<a href="https://huggingface.co/{models[13]}">{models[13]}</a><br>
<a href="https://huggingface.co/{models[14]}">{models[14]}</a><br>
<a href="https://huggingface.co/{models[15]}">{models[15]}</a><br>
<a href="https://huggingface.co/{models[16]}">{models[16]}</a><br>
<a href="https://huggingface.co/{models[17]}">{models[17]}</a><br>
<a href="https://huggingface.co/{models[18]}">{models[18]}</a><br>
<a href="https://huggingface.co/{models[19]}">{models[19]}</a><br>
<a href="https://huggingface.co/{models[20]}">{models[20]}</a><br>
</p>
</div>
""")
with gr.Row():
with gr.Column():
input_text=gr.Textbox(label="Short Prompt")
prompt=gr.Textbox(label="Text to Image Prompt",visible=True)
model_name1 = gr.Dropdown(show_label=False, choices=[m for m in models], type="index", value=current_model, interactive=True)
count = gr.Number(value=1)
with gr.Column():
see_prompts=gr.Button("Magic Prompt")
with gr.Row():
run=gr.Button("Launch")
clear_btn=gr.Button("Clear")
with gr.Column(visible=True) as timo:
with gr.Row():
output1=gr.Gallery(columns=2)
def get_prompts(prompt_text):
gen=text_gen(prompt_text)
return gen
run1=run.click(send_it1, inputs=[prompt, model_name1,count], outputs=[output1])
myface.queue(concurrency_count=400,status_update_rate=1)
myface.launch(inline=True,show_api=True)
|