darkstorm2150 commited on
Commit
cb1effc
1 Parent(s): d607bde

Rename app.py.old to app.py

Browse files
Files changed (2) hide show
  1. app.py +36 -0
  2. app.py.old +0 -362
app.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from subprocess import getoutput
3
+
4
+ gpu_info = getoutput('nvidia-smi')
5
+ if("A10G" in gpu_info):
6
+ os.system(f"pip install -q https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.17/xformers-0.0.17+b6be33a.d20230315-cp39-cp39-linux_x86_64.whl")
7
+ elif("T4" in gpu_info):
8
+ os.system(f"pip install -q https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.17/xformers-0.0.17+b6be33a.d20230315-cp39-cp39-linux_x86_64.whl")
9
+
10
+ os.system(f"git clone -b v1.5 https://github.com/camenduru/stable-diffusion-webui /home/user/app/stable-diffusion-webui")
11
+ os.chdir("/home/user/app/stable-diffusion-webui")
12
+
13
+ os.system(f"wget -q https://github.com/camenduru/webui/raw/main/env_patch.py -O /home/user/app/env_patch.py")
14
+ os.system(f"sed -i '$a fastapi==0.90.0' /home/user/app/stable-diffusion-webui/requirements_versions.txt")
15
+ os.system(f"sed -i -e '/import image_from_url_text/r /home/user/app/env_patch.py' /home/user/app/stable-diffusion-webui/modules/ui.py")
16
+ os.system(f"sed -i -e '/(modelmerger_interface, \"Checkpoint Merger\", \"modelmerger\"),/d' /home/user/app/stable-diffusion-webui/modules/ui.py")
17
+ os.system(f"sed -i -e '/(train_interface, \"Train\", \"ti\"),/d' /home/user/app/stable-diffusion-webui/modules/ui.py")
18
+ os.system(f"sed -i -e '/extensions_interface, \"Extensions\", \"extensions\"/d' /home/user/app/stable-diffusion-webui/modules/ui.py")
19
+ os.system(f"sed -i -e '/settings_interface, \"Settings\", \"settings\"/d' /home/user/app/stable-diffusion-webui/modules/ui.py")
20
+ os.system(f'''sed -i -e "s/document.getElementsByTagName('gradio-app')\[0\].shadowRoot/!!document.getElementsByTagName('gradio-app')[0].shadowRoot ? document.getElementsByTagName('gradio-app')[0].shadowRoot : document/g" /home/user/app/stable-diffusion-webui/script.js''')
21
+ os.system(f"sed -i -e 's/ show_progress=False,/ show_progress=True,/g' /home/user/app/stable-diffusion-webui/modules/ui.py")
22
+ os.system(f"sed -i -e 's/shared.demo.launch/shared.demo.queue().launch/g' /home/user/app/stable-diffusion-webui/webui.py")
23
+ os.system(f"sed -i -e 's/ outputs=\[/queue=False, &/g' /home/user/app/stable-diffusion-webui/modules/ui.py")
24
+ os.system(f"sed -i -e 's/ queue=False, / /g' /home/user/app/stable-diffusion-webui/modules/ui.py")
25
+
26
+ # ----------------------------Please duplicate this space and delete this block if you don't want to see the extra header----------------------------
27
+ os.system(f"wget -q https://github.com/darkstorm2150/webui/raw/main/OpenGen_header_patch.py -O /home/user/app/OpenGen_header_patch.py")
28
+ os.system(f"sed -i -e '/ui.py /r /home/user/app/OpenGen_header_patch.py' /home/user/app/stable-diffusion-webui/modules/ui.py")
29
+ os.system(f"rm /home/user/app/OpenGen_header_patch.py")
30
+ # ------------------------------------------------------------------------------------------------------------------------------
31
+
32
+ if("IS_SHARED_UI" in os.environ):
33
+ os.system(f"sed -i -e 's/cdn.gradio.app/images.gradio.app/g' /home/user/app/stable-diffusion-webui/modules/ui.py")
34
+ os.system(f"sed -i -e 's/gradio.app/camenduru.com/g' /home/user/app/stable-diffusion-webui/modules/ui.py")
35
+ os.system(f"wget https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.15/stable-diffusion-webui-cp38-cp38-linux_x86_64.whl -O /home/user/app/stable-diffusion-webui-cp38-cp38-linux_x86_64.whl")
36
+ os.system(f"pip install -q --no-deps /home/user/app/stable-diffusion-webui-cp38-cp38-linux_x86_64.whl")
app.py.old DELETED
@@ -1,362 +0,0 @@
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()