Spaces:
Runtime error
Runtime error
Commit
·
11a9900
0
Parent(s):
Duplicate from darkstorm2150/protogen-web-ui
Browse files- .gitattributes +34 -0
- README.md +14 -0
- app.py +362 -0
- nsfw.png +0 -0
- requirements.txt +16 -0
- style.css +24 -0
- utils.py +6 -0
.gitattributes
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Protogen Web-UI
|
3 |
+
emoji: 🪄
|
4 |
+
colorFrom: blue
|
5 |
+
colorTo: pink
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 3.15.0
|
8 |
+
app_file: app.py
|
9 |
+
pinned: true
|
10 |
+
license: mit
|
11 |
+
duplicated_from: darkstorm2150/protogen-web-ui
|
12 |
+
---
|
13 |
+
|
14 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,362 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from diffusers import (
|
2 |
+
StableDiffusionPipeline,
|
3 |
+
StableDiffusionImg2ImgPipeline,
|
4 |
+
DPMSolverMultistepScheduler,
|
5 |
+
)
|
6 |
+
import gradio as gr
|
7 |
+
import torch
|
8 |
+
from PIL import Image
|
9 |
+
import time
|
10 |
+
import psutil
|
11 |
+
import random
|
12 |
+
from diffusers.pipelines.stable_diffusion.safety_checker import StableDiffusionSafetyChecker
|
13 |
+
|
14 |
+
|
15 |
+
start_time = time.time()
|
16 |
+
current_steps = 25
|
17 |
+
|
18 |
+
SAFETY_CHECKER = StableDiffusionSafetyChecker.from_pretrained("CompVis/stable-diffusion-safety-checker", torch_dtype=torch.float16)
|
19 |
+
|
20 |
+
|
21 |
+
class Model:
|
22 |
+
def __init__(self, name, path=""):
|
23 |
+
self.name = name
|
24 |
+
self.path = path
|
25 |
+
|
26 |
+
if path != "":
|
27 |
+
self.pipe_t2i = StableDiffusionPipeline.from_pretrained(
|
28 |
+
path, torch_dtype=torch.float16, safety_checker=SAFETY_CHECKER
|
29 |
+
)
|
30 |
+
self.pipe_t2i.scheduler = DPMSolverMultistepScheduler.from_config(
|
31 |
+
self.pipe_t2i.scheduler.config
|
32 |
+
)
|
33 |
+
self.pipe_i2i = StableDiffusionImg2ImgPipeline(**self.pipe_t2i.components)
|
34 |
+
else:
|
35 |
+
self.pipe_t2i = None
|
36 |
+
self.pipe_i2i = None
|
37 |
+
|
38 |
+
|
39 |
+
models = [
|
40 |
+
Model("Protogen v2.2 (Anime)", "darkstorm2150/Protogen_v2.2_Official_Release"),
|
41 |
+
Model("Protogen x3.4 (Photorealism)", "darkstorm2150/Protogen_x3.4_Official_Release"),
|
42 |
+
Model("Protogen x5.3 (Photorealism)", "darkstorm2150/Protogen_x5.3_Official_Release"),
|
43 |
+
Model("Protogen x5.8 Rebuilt (Scifi+Anime)", "darkstorm2150/Protogen_x5.8_Official_Release"),
|
44 |
+
Model("Protogen Dragon (RPG Model)", "darkstorm2150/Protogen_Dragon_Official_Release"),
|
45 |
+
Model("Protogen Nova", "darkstorm2150/Protogen_Nova_Official_Release"),
|
46 |
+
Model("Protogen Eclipse", "darkstorm2150/Protogen_Eclipse_Official_Release"),
|
47 |
+
Model("Protogen Infinity", "darkstorm2150/Protogen_Infinity_Official_Release"),
|
48 |
+
]
|
49 |
+
|
50 |
+
MODELS = {m.name: m for m in models}
|
51 |
+
|
52 |
+
device = "GPU 🔥" if torch.cuda.is_available() else "CPU 🥶"
|
53 |
+
|
54 |
+
|
55 |
+
def error_str(error, title="Error"):
|
56 |
+
return (
|
57 |
+
f"""#### {title}
|
58 |
+
{error}"""
|
59 |
+
if error
|
60 |
+
else ""
|
61 |
+
)
|
62 |
+
|
63 |
+
|
64 |
+
def inference(
|
65 |
+
model_name,
|
66 |
+
prompt,
|
67 |
+
guidance,
|
68 |
+
steps,
|
69 |
+
n_images=1,
|
70 |
+
width=512,
|
71 |
+
height=512,
|
72 |
+
seed=0,
|
73 |
+
img=None,
|
74 |
+
strength=0.5,
|
75 |
+
neg_prompt="",
|
76 |
+
):
|
77 |
+
|
78 |
+
print(psutil.virtual_memory()) # print memory usage
|
79 |
+
|
80 |
+
if seed == 0:
|
81 |
+
seed = random.randint(0, 2147483647)
|
82 |
+
|
83 |
+
generator = torch.Generator("cuda").manual_seed(seed)
|
84 |
+
|
85 |
+
try:
|
86 |
+
if img is not None:
|
87 |
+
return (
|
88 |
+
img_to_img(
|
89 |
+
model_name,
|
90 |
+
prompt,
|
91 |
+
n_images,
|
92 |
+
neg_prompt,
|
93 |
+
img,
|
94 |
+
strength,
|
95 |
+
guidance,
|
96 |
+
steps,
|
97 |
+
width,
|
98 |
+
height,
|
99 |
+
generator,
|
100 |
+
seed,
|
101 |
+
),
|
102 |
+
f"Done. Seed: {seed}",
|
103 |
+
)
|
104 |
+
else:
|
105 |
+
return (
|
106 |
+
txt_to_img(
|
107 |
+
model_name,
|
108 |
+
prompt,
|
109 |
+
n_images,
|
110 |
+
neg_prompt,
|
111 |
+
guidance,
|
112 |
+
steps,
|
113 |
+
width,
|
114 |
+
height,
|
115 |
+
generator,
|
116 |
+
seed,
|
117 |
+
),
|
118 |
+
f"Done. Seed: {seed}",
|
119 |
+
)
|
120 |
+
except Exception as e:
|
121 |
+
return None, error_str(e)
|
122 |
+
|
123 |
+
|
124 |
+
def txt_to_img(
|
125 |
+
model_name,
|
126 |
+
prompt,
|
127 |
+
n_images,
|
128 |
+
neg_prompt,
|
129 |
+
guidance,
|
130 |
+
steps,
|
131 |
+
width,
|
132 |
+
height,
|
133 |
+
generator,
|
134 |
+
seed,
|
135 |
+
):
|
136 |
+
pipe = MODELS[model_name].pipe_t2i
|
137 |
+
|
138 |
+
if torch.cuda.is_available():
|
139 |
+
pipe = pipe.to("cuda")
|
140 |
+
pipe.enable_xformers_memory_efficient_attention()
|
141 |
+
|
142 |
+
result = pipe(
|
143 |
+
prompt,
|
144 |
+
negative_prompt=neg_prompt,
|
145 |
+
num_images_per_prompt=n_images,
|
146 |
+
num_inference_steps=int(steps),
|
147 |
+
guidance_scale=guidance,
|
148 |
+
width=width,
|
149 |
+
height=height,
|
150 |
+
generator=generator,
|
151 |
+
)
|
152 |
+
|
153 |
+
pipe.to("cpu")
|
154 |
+
torch.cuda.empty_cache()
|
155 |
+
|
156 |
+
return replace_nsfw_images(result)
|
157 |
+
|
158 |
+
|
159 |
+
def img_to_img(
|
160 |
+
model_name,
|
161 |
+
prompt,
|
162 |
+
n_images,
|
163 |
+
neg_prompt,
|
164 |
+
img,
|
165 |
+
strength,
|
166 |
+
guidance,
|
167 |
+
steps,
|
168 |
+
width,
|
169 |
+
height,
|
170 |
+
generator,
|
171 |
+
seed,
|
172 |
+
):
|
173 |
+
pipe = MODELS[model_name].pipe_i2i
|
174 |
+
|
175 |
+
if torch.cuda.is_available():
|
176 |
+
pipe = pipe.to("cuda")
|
177 |
+
pipe.enable_xformers_memory_efficient_attention()
|
178 |
+
|
179 |
+
ratio = min(height / img.height, width / img.width)
|
180 |
+
img = img.resize((int(img.width * ratio), int(img.height * ratio)), Image.LANCZOS)
|
181 |
+
|
182 |
+
result = pipe(
|
183 |
+
prompt,
|
184 |
+
negative_prompt=neg_prompt,
|
185 |
+
num_images_per_prompt=n_images,
|
186 |
+
image=img,
|
187 |
+
num_inference_steps=int(steps),
|
188 |
+
strength=strength,
|
189 |
+
guidance_scale=guidance,
|
190 |
+
generator=generator,
|
191 |
+
)
|
192 |
+
|
193 |
+
pipe.to("cpu")
|
194 |
+
torch.cuda.empty_cache()
|
195 |
+
|
196 |
+
return replace_nsfw_images(result)
|
197 |
+
|
198 |
+
|
199 |
+
def replace_nsfw_images(results):
|
200 |
+
for i in range(len(results.images)):
|
201 |
+
if results.nsfw_content_detected[i]:
|
202 |
+
results.images[i] = Image.open("nsfw.png")
|
203 |
+
return results.images
|
204 |
+
|
205 |
+
|
206 |
+
with gr.Blocks(css="style.css") as demo:
|
207 |
+
gr.HTML(
|
208 |
+
f"""
|
209 |
+
<div class="finetuned-diffusion-div">
|
210 |
+
<div>
|
211 |
+
<h1>Protogen Diffusion</h1>
|
212 |
+
</div>
|
213 |
+
<p>
|
214 |
+
Demo for multiple fine-tuned Protogen Stable Diffusion models.
|
215 |
+
</p>
|
216 |
+
<p>
|
217 |
+
Running on <b>{device}</b>
|
218 |
+
</p>
|
219 |
+
<p>You can also duplicate this space and upgrade to gpu by going to settings:<br>
|
220 |
+
<a style="display:inline-block" href="https://huggingface.co/spaces/patrickvonplaten/finetuned_diffusion?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a></p>
|
221 |
+
</div>
|
222 |
+
"""
|
223 |
+
)
|
224 |
+
with gr.Row():
|
225 |
+
|
226 |
+
with gr.Column(scale=55):
|
227 |
+
with gr.Group():
|
228 |
+
model_name = gr.Dropdown(
|
229 |
+
label="Model",
|
230 |
+
choices=[m.name for m in models],
|
231 |
+
value=models[0].name,
|
232 |
+
)
|
233 |
+
with gr.Box(visible=False) as custom_model_group:
|
234 |
+
custom_model_path = gr.Textbox(
|
235 |
+
label="Custom model path",
|
236 |
+
placeholder="Path to model, e.g. darkstorm2150/Protogen_x3.4_Official_Release",
|
237 |
+
interactive=True,
|
238 |
+
)
|
239 |
+
gr.HTML(
|
240 |
+
"<div><font size='2'>Custom models have to be downloaded first, so give it some time.</font></div>"
|
241 |
+
)
|
242 |
+
|
243 |
+
with gr.Row():
|
244 |
+
prompt = gr.Textbox(
|
245 |
+
label="Prompt",
|
246 |
+
show_label=False,
|
247 |
+
max_lines=2,
|
248 |
+
placeholder="Enter prompt.",
|
249 |
+
).style(container=False)
|
250 |
+
generate = gr.Button(value="Generate").style(
|
251 |
+
rounded=(False, True, True, False)
|
252 |
+
)
|
253 |
+
|
254 |
+
# image_out = gr.Image(height=512)
|
255 |
+
gallery = gr.Gallery(
|
256 |
+
label="Generated images", show_label=False, elem_id="gallery"
|
257 |
+
).style(grid=[2], height="auto")
|
258 |
+
|
259 |
+
state_info = gr.Textbox(label="State", show_label=False, max_lines=2).style(
|
260 |
+
container=False
|
261 |
+
)
|
262 |
+
error_output = gr.Markdown()
|
263 |
+
|
264 |
+
with gr.Column(scale=45):
|
265 |
+
with gr.Tab("Options"):
|
266 |
+
with gr.Group():
|
267 |
+
neg_prompt = gr.Textbox(
|
268 |
+
label="Negative prompt",
|
269 |
+
placeholder="What to exclude from the image",
|
270 |
+
)
|
271 |
+
|
272 |
+
n_images = gr.Slider(
|
273 |
+
label="Images", value=1, minimum=1, maximum=4, step=1
|
274 |
+
)
|
275 |
+
|
276 |
+
with gr.Row():
|
277 |
+
guidance = gr.Slider(
|
278 |
+
label="Guidance scale", value=7.5, maximum=15
|
279 |
+
)
|
280 |
+
steps = gr.Slider(
|
281 |
+
label="Steps",
|
282 |
+
value=current_steps,
|
283 |
+
minimum=2,
|
284 |
+
maximum=75,
|
285 |
+
step=1,
|
286 |
+
)
|
287 |
+
|
288 |
+
with gr.Row():
|
289 |
+
width = gr.Slider(
|
290 |
+
label="Width", value=512, minimum=64, maximum=1024, step=8
|
291 |
+
)
|
292 |
+
height = gr.Slider(
|
293 |
+
label="Height", value=512, minimum=64, maximum=1024, step=8
|
294 |
+
)
|
295 |
+
|
296 |
+
seed = gr.Slider(
|
297 |
+
0, 2147483647, label="Seed (0 = random)", value=0, step=1
|
298 |
+
)
|
299 |
+
|
300 |
+
with gr.Tab("Image to image"):
|
301 |
+
with gr.Group():
|
302 |
+
image = gr.Image(
|
303 |
+
label="Image", height=256, tool="editor", type="pil"
|
304 |
+
)
|
305 |
+
strength = gr.Slider(
|
306 |
+
label="Transformation strength",
|
307 |
+
minimum=0,
|
308 |
+
maximum=1,
|
309 |
+
step=0.01,
|
310 |
+
value=0.5,
|
311 |
+
)
|
312 |
+
|
313 |
+
inputs = [
|
314 |
+
model_name,
|
315 |
+
prompt,
|
316 |
+
guidance,
|
317 |
+
steps,
|
318 |
+
n_images,
|
319 |
+
width,
|
320 |
+
height,
|
321 |
+
seed,
|
322 |
+
image,
|
323 |
+
strength,
|
324 |
+
neg_prompt,
|
325 |
+
]
|
326 |
+
outputs = [gallery, error_output]
|
327 |
+
prompt.submit(inference, inputs=inputs, outputs=outputs)
|
328 |
+
generate.click(inference, inputs=inputs, outputs=outputs)
|
329 |
+
|
330 |
+
ex = gr.Examples(
|
331 |
+
[
|
332 |
+
[models[0].name, "portrait of a beautiful alyx vance half life", 10, 50, "canvas frame, ((disfigured)), ((bad art)), ((deformed)),((extra limbs)),((close up)),((b&w)), weird colors, blurry, (((duplicate))), ((morbid)), ((mutilated)), [out of frame], extra fingers, mutated hands, ((poorly drawn hands)), ((poorly drawn face)), (((mutation))), (((deformed))), blurry, ((bad anatomy)), (((bad proportions))), ((extra limbs)), cloned face, (((disfigured))), out of frame, ugly, extra limbs, (bad anatomy), gross proportions, (malformed limbs), ((missing arms)), ((missing legs)), (((extra arms))), (((extra legs))), mutated hands, (fused fingers), (too many fingers), (((long neck))), Photoshop, video game, ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, mutation, mutated, extra limbs, extra legs, extra arms, disfigured, deformed, cross-eye, body out of frame, blurry, bad art, bad anatomy"],
|
333 |
+
[models[1].name, "Brad Pitt with sunglasses, highly realistic", 7.5, 50, "canvas frame, ((disfigured)), ((bad art)), ((deformed)),((extra limbs)),((close up)),((b&w)), weird colors, blurry, (((duplicate))), ((morbid)), ((mutilated)), [out of frame], extra fingers, mutated hands, ((poorly drawn hands)), ((poorly drawn face)), (((mutation))), (((deformed))), blurry, ((bad anatomy)), (((bad proportions))), ((extra limbs)), cloned face, (((disfigured))), out of frame, ugly, extra limbs, (bad anatomy), gross proportions, (malformed limbs), ((missing arms)), ((missing legs)), (((extra arms))), (((extra legs))), mutated hands, (fused fingers), (too many fingers), (((long neck))), Photoshop, video game, ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, mutation, mutated, extra limbs, extra legs, extra arms, disfigured, deformed, cross-eye, body out of frame, blurry, bad art, bad anatomy"],
|
334 |
+
[models[2].name, "(extremely detailed CG unity 8k wallpaper), the most beautiful artwork in the world", 7.5, 50, "human, people, canvas frame, ((disfigured)), ((bad art)), ((deformed)),((extra limbs)),((close up)),((b&w)), weird colors, blurry, (((duplicate))), ((morbid)), ((mutilated)), [out of frame], extra fingers, mutated hands, ((poorly drawn hands)), ((poorly drawn face)), (((mutation))), (((deformed))), blurry, ((bad anatomy)), (((bad proportions))), ((extra limbs)), cloned face, (((disfigured))), out of frame, ugly, extra limbs, (bad anatomy), gross proportions, (malformed limbs), ((missing arms)), ((missing legs)), (((extra arms))), (((extra legs))), mutated hands, (fused fingers), (too many fingers), (((long neck))), Photoshop, video game, ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, mutation, mutated, extra limbs, extra legs, extra arms, disfigured, deformed, cross-eye, body out of frame, blurry, bad art, bad anatomy"],
|
335 |
+
[models[3].name, "(extremely detailed CG unity 8k wallpaper), full shot body photo star lord chris pratt posing in an outdoor spaceship, holding a gun, extremely detailed, trending on ArtStation, trending on CGSociety, Intricate, High Detail, dramatic, realism, beautiful and detailed lighting, shadows", 7.5, 50, "canvas frame, ((disfigured)), ((bad art)), ((deformed)),((extra limbs)),((close up)),((b&w)), weird colors, blurry, (((duplicate))), ((morbid)), ((mutilated)), [out of frame], extra fingers, mutated hands, ((poorly drawn hands)), ((poorly drawn face)), (((mutation))), (((deformed))), blurry, ((bad anatomy)), (((bad proportions))), ((extra limbs)), cloned face, (((disfigured))), out of frame, ugly, extra limbs, (bad anatomy), gross proportions, (malformed limbs), ((missing arms)), ((missing legs)), (((extra arms))), (((extra legs))), mutated hands, (fused fingers), (too many fingers), (((long neck))), Photoshop, video game, ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, mutation, mutated, extra limbs, extra legs, extra arms, disfigured, deformed, cross-eye, body out of frame, blurry, bad art, bad anatomy"],
|
336 |
+
[models[4].name, "(extremely detailed CG unity 8k wallpaper), full body portrait of (david:1.1), staring at us with a mysterious gaze, realistic, masterpiece, highest quality, ((scifi)), lens flare, ((light sparkles)), unreal engine, digital painting, trending on ArtStation, trending on CGSociety, Intricate, High Detail, dramatic, realism, beautiful and detailed lighting, shadows", 7.5, 50, "canvas frame, ((disfigured)), ((bad art)), ((deformed)),((extra limbs)),((close up)),((b&w)), weird colors, blurry, (((duplicate))), ((morbid)), ((mutilated)), [out of frame], extra fingers, mutated hands, ((poorly drawn hands)), ((poorly drawn face)), (((mutation))), (((deformed))), blurry, ((bad anatomy)), (((bad proportions))), ((extra limbs)), cloned face, (((disfigured))), out of frame, ugly, extra limbs, (bad anatomy), gross proportions, (malformed limbs), ((missing arms)), ((missing legs)), (((extra arms))), (((extra legs))), mutated hands, (fused fingers), (too many fingers), (((long neck))), Photoshop, video game, ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, mutation, mutated, extra limbs, extra legs, extra arms, disfigured, deformed, cross-eye, body out of frame, blurry, bad art, bad anatomy"],
|
337 |
+
[models[5].name, "(extremely detailed CG unity 8k wallpaper), full body portrait of (david:1.1), staring at us with a mysterious gaze, realistic, masterpiece, highest quality, ((scifi)), lens flare, ((light sparkles)), unreal engine, digital painting, trending on ArtStation, trending on CGSociety, Intricate, High Detail, dramatic, realism, beautiful and detailed lighting, shadows", 7.5, 50, "canvas frame, ((disfigured)), ((bad art)), ((deformed)),((extra limbs)),((close up)),((b&w)), weird colors, blurry, (((duplicate))), ((morbid)), ((mutilated)), [out of frame], extra fingers, mutated hands, ((poorly drawn hands)), ((poorly drawn face)), (((mutation))), (((deformed))), blurry, ((bad anatomy)), (((bad proportions))), ((extra limbs)), cloned face, (((disfigured))), out of frame, ugly, extra limbs, (bad anatomy), gross proportions, (malformed limbs), ((missing arms)), ((missing legs)), (((extra arms))), (((extra legs))), mutated hands, (fused fingers), (too many fingers), (((long neck))), Photoshop, video game, ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, mutation, mutated, extra limbs, extra legs, extra arms, disfigured, deformed, cross-eye, body out of frame, blurry, bad art, bad anatomy"],
|
338 |
+
[models[6].name, "(extremely detailed CG unity 8k wallpaper), full body portrait of (david:1.1), staring at us with a mysterious gaze, realistic, masterpiece, highest quality, ((scifi)), lens flare, ((light sparkles)), unreal engine, digital painting, trending on ArtStation, trending on CGSociety, Intricate, High Detail, dramatic, realism, beautiful and detailed lighting, shadows", 7.5, 50, "canvas frame, ((disfigured)), ((bad art)), ((deformed)),((extra limbs)),((close up)),((b&w)), weird colors, blurry, (((duplicate))), ((morbid)), ((mutilated)), [out of frame], extra fingers, mutated hands, ((poorly drawn hands)), ((poorly drawn face)), (((mutation))), (((deformed))), blurry, ((bad anatomy)), (((bad proportions))), ((extra limbs)), cloned face, (((disfigured))), out of frame, ugly, extra limbs, (bad anatomy), gross proportions, (malformed limbs), ((missing arms)), ((missing legs)), (((extra arms))), (((extra legs))), mutated hands, (fused fingers), (too many fingers), (((long neck))), Photoshop, video game, ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, mutation, mutated, extra limbs, extra legs, extra arms, disfigured, deformed, cross-eye, body out of frame, blurry, bad art, bad anatomy"],
|
339 |
+
[models[7].name, "(extremely detailed CG unity 8k wallpaper), full body portrait of (david:1.1), staring at us with a mysterious gaze, realistic, masterpiece, highest quality, ((scifi)), lens flare, ((light sparkles)), unreal engine, digital painting, trending on ArtStation, trending on CGSociety, Intricate, High Detail, dramatic, realism, beautiful and detailed lighting, shadows", 7.5, 50, "canvas frame, ((disfigured)), ((bad art)), ((deformed)),((extra limbs)),((close up)),((b&w)), weird colors, blurry, (((duplicate))), ((morbid)), ((mutilated)), [out of frame], extra fingers, mutated hands, ((poorly drawn hands)), ((poorly drawn face)), (((mutation))), (((deformed))), blurry, ((bad anatomy)), (((bad proportions))), ((extra limbs)), cloned face, (((disfigured))), out of frame, ugly, extra limbs, (bad anatomy), gross proportions, (malformed limbs), ((missing arms)), ((missing legs)), (((extra arms))), (((extra legs))), mutated hands, (fused fingers), (too many fingers), (((long neck))), Photoshop, video game, ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, mutation, mutated, extra limbs, extra legs, extra arms, disfigured, deformed, cross-eye, body out of frame, blurry, bad art, bad anatomy"],
|
340 |
+
],
|
341 |
+
inputs=[model_name, prompt, guidance, steps, neg_prompt],
|
342 |
+
outputs=outputs,
|
343 |
+
fn=inference,
|
344 |
+
cache_examples=False,
|
345 |
+
)
|
346 |
+
|
347 |
+
gr.HTML(
|
348 |
+
"""
|
349 |
+
<div style="border-top: 1px solid #303030;">
|
350 |
+
<br>
|
351 |
+
<p>Models by <a href="https://huggingface.co/darkstorm2150">@darkstorm2150</a> and others. ❤️</p>
|
352 |
+
<p>This space uses the <a href="https://github.com/LuChengTHU/dpm-solver">DPM-Solver++</a> sampler by <a href="https://arxiv.org/abs/2206.00927">Cheng Lu, et al.</a>.</p>
|
353 |
+
<p>Space by: Darkstorm (Victor Espinoza)<br>
|
354 |
+
<a href="https://www.instagram.com/officialvictorespinoza/">Instagram</a>
|
355 |
+
</div>
|
356 |
+
"""
|
357 |
+
)
|
358 |
+
|
359 |
+
print(f"Space built in {time.time() - start_time:.2f} seconds")
|
360 |
+
|
361 |
+
demo.queue(concurrency_count=1)
|
362 |
+
demo.launch()
|
nsfw.png
ADDED
![]() |
requirements.txt
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
--extra-index-url https://download.pytorch.org/whl/cu113
|
2 |
+
torch
|
3 |
+
torchvision==0.13.1+cu113
|
4 |
+
#diffusers
|
5 |
+
git+https://github.com/huggingface/diffusers.git
|
6 |
+
#transformers
|
7 |
+
git+https://github.com/huggingface/transformers
|
8 |
+
scipy
|
9 |
+
ftfy
|
10 |
+
psutil
|
11 |
+
accelerate==0.12.0
|
12 |
+
#OmegaConf
|
13 |
+
#pytorch_lightning
|
14 |
+
triton==2.0.0.dev20220701
|
15 |
+
#https://github.com/apolinario/xformers/releases/download/0.0.3/xformers-0.0.14.dev0-cp38-cp38-linux_x86_64.whl
|
16 |
+
https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.15/xformers-0.0.15.dev0+4c06c79.d20221205-cp38-cp38-linux_x86_64.whl
|
style.css
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.finetuned-diffusion-div div{
|
2 |
+
display:inline-flex;
|
3 |
+
align-items:center;
|
4 |
+
gap:.8rem;
|
5 |
+
font-size:1.75rem
|
6 |
+
}
|
7 |
+
.finetuned-diffusion-div div h1{
|
8 |
+
font-weight:900;
|
9 |
+
margin-bottom:7px
|
10 |
+
}
|
11 |
+
.finetuned-diffusion-div p{
|
12 |
+
margin-bottom:10px;
|
13 |
+
font-size:94%
|
14 |
+
}
|
15 |
+
a{
|
16 |
+
text-decoration:underline
|
17 |
+
}
|
18 |
+
.tabs{
|
19 |
+
margin-top:0;
|
20 |
+
margin-bottom:0
|
21 |
+
}
|
22 |
+
#gallery{
|
23 |
+
min-height:20rem
|
24 |
+
}
|
utils.py
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
def is_google_colab():
|
2 |
+
try:
|
3 |
+
import google.colab
|
4 |
+
return True
|
5 |
+
except:
|
6 |
+
return False
|