Deadmon commited on
Commit
83a9b00
1 Parent(s): 033c6a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +208 -138
app.py CHANGED
@@ -9,35 +9,142 @@ import torchvision.transforms.functional as TF
9
 
10
  from diffusers import ControlNetModel, StableDiffusionXLControlNetPipeline, AutoencoderKL
11
  from diffusers import DDIMScheduler, EulerAncestralDiscreteScheduler
12
- from controlnet_aux import OpenposeDetector, MidasDetector, CannyDetector, LineartDetector, LineartAnimeDetector, MLSDdetector, HEDdetector, PidiNetDetector, NormalBaeDetector, SamDetector
13
  from diffusers.utils import load_image
14
  from huggingface_hub import HfApi
15
  from pathlib import Path
16
  from PIL import Image, ImageOps
 
 
17
  import cv2
 
 
18
  import spaces
19
  from gradio_imageslider import ImageSlider
20
 
21
- # ... (keep the existing helper functions like nms, HWC3, etc.)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
- # Initialize all detectors
24
- openpose_detector = OpenposeDetector.from_pretrained('lllyasviel/ControlNet')
25
- midas_detector = MidasDetector.from_pretrained('lllyasviel/ControlNet')
26
- canny_detector = CannyDetector()
27
- lineart_detector = LineartDetector.from_pretrained("lllyasviel/Annotators")
28
- anime_lineart_detector = LineartAnimeDetector.from_pretrained("lllyasviel/Annotators")
29
- mlsd_detector = MLSDdetector.from_pretrained('lllyasviel/ControlNet')
30
- hed_detector = HEDdetector.from_pretrained('lllyasviel/ControlNet')
31
- pidi_detector = PidiNetDetector.from_pretrained('lllyasviel/Annotators')
32
- normal_detector = NormalBaeDetector.from_pretrained('lllyasviel/Annotators')
33
- sam_detector = SamDetector.from_pretrained('ybelkada/segment-anything', subfolder='checkpoints')
34
 
35
- # ... (keep the existing style_list and other configurations)
 
 
 
 
 
 
 
 
36
 
37
  controlnet = ControlNetModel.from_pretrained(
38
  "xinsir/controlnet-union-sdxl-1.0",
39
  torch_dtype=torch.float16
40
  )
 
 
 
 
 
 
41
 
42
  pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
43
  "stabilityai/stable-diffusion-xl-base-1.0",
@@ -47,6 +154,41 @@ pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
47
  scheduler=eulera_scheduler,
48
  )
49
  pipe.to(device)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
  @spaces.GPU
52
  def run(
@@ -58,116 +200,71 @@ def run(
58
  guidance_scale: float = 5,
59
  controlnet_conditioning_scale: float = 1.0,
60
  seed: int = 0,
61
- use_openpose: bool = False,
62
- use_depth: bool = False,
63
- use_canny: bool = False,
64
- use_lineart: bool = False,
65
- use_anime_lineart: bool = False,
66
- use_mlsd: bool = False,
67
- use_scribble: bool = False,
68
  use_hed: bool = False,
69
- use_softedge: bool = False,
70
- use_teed: bool = False,
71
- use_segment: bool = False,
72
- use_normal: bool = False,
73
  progress=gr.Progress(track_tqdm=True),
74
  ) -> PIL.Image.Image:
 
75
  composite_image = image['composite']
76
  width, height = composite_image.size
77
 
 
78
  max_size = 1024
79
  ratio = min(max_size / width, max_size / height)
80
  new_width = int(width * ratio)
81
  new_height = int(height * ratio)
82
 
 
83
  resized_image = composite_image.resize((new_width, new_height), Image.LANCZOS)
84
 
85
- control_images = []
86
- control_type = [0, 0, 0, 0, 0, 0] # Initialize control type
87
-
88
- if use_openpose:
89
- openpose_image = openpose_detector(resized_image)
90
- control_images.append(openpose_image)
91
- control_type[0] = 1
92
-
93
- if use_depth:
94
- depth_image = midas_detector(resized_image)
95
- control_images.append(depth_image)
96
- control_type[1] = 1
97
-
98
  if use_canny:
99
- canny_image = canny_detector(resized_image)
100
- control_images.append(canny_image)
101
- control_type[3] = 1
102
-
103
- if use_lineart:
104
- lineart_image = lineart_detector(resized_image)
105
- control_images.append(lineart_image)
106
- control_type[3] = 1
107
-
108
- if use_anime_lineart:
109
- anime_lineart_image = anime_lineart_detector(resized_image)
110
- control_images.append(anime_lineart_image)
111
- control_type[3] = 1
 
 
 
112
 
113
- if use_mlsd:
114
- mlsd_image = mlsd_detector(resized_image)
115
- control_images.append(mlsd_image)
116
- control_type[3] = 1
117
-
118
- if use_scribble:
119
- # Assuming scribble is the same as the input image
120
- control_images.append(resized_image)
121
- control_type[2] = 1
122
-
123
- if use_hed:
124
- hed_image = hed_detector(resized_image)
125
- control_images.append(hed_image)
126
- control_type[2] = 1
127
-
128
- if use_softedge:
129
- softedge_image = pidi_detector(resized_image)
130
- control_images.append(softedge_image)
131
- control_type[2] = 1
132
-
133
- if use_teed:
134
- # Assuming TEED is similar to HED but with thinner lines
135
- teed_image = hed_detector(resized_image, detect_resolution=512)
136
- control_images.append(teed_image)
137
- control_type[2] = 1
138
-
139
- if use_segment:
140
- segment_image = sam_detector(resized_image)
141
- control_images.append(segment_image)
142
- control_type[5] = 1
143
-
144
- if use_normal:
145
- normal_image = normal_detector(resized_image)
146
- control_images.append(normal_image)
147
- control_type[4] = 1
148
-
149
- if not control_images:
150
- control_images.append(resized_image)
151
- control_type[2] = 1 # Default to thick line type if no specific control is used
152
-
153
  prompt, negative_prompt = apply_style(style_name, prompt, negative_prompt)
154
 
155
  generator = torch.Generator(device=device).manual_seed(seed)
156
 
157
- out = pipe(
158
- prompt=prompt,
159
- negative_prompt=negative_prompt,
160
- image=control_images,
161
- num_inference_steps=num_steps,
162
- generator=generator,
163
- controlnet_conditioning_scale=[controlnet_conditioning_scale] * len(control_images),
164
- control_type=control_type,
165
- guidance_scale=guidance_scale,
166
- width=new_width,
167
- height=new_height,
168
- ).images[0]
169
-
170
- return (control_images[0], out)
 
 
 
 
 
 
 
 
 
 
 
 
171
 
172
  with gr.Blocks(css="style.css", js=js_func) as demo:
173
  gr.Markdown(DESCRIPTION, elem_id="description")
@@ -183,19 +280,8 @@ with gr.Blocks(css="style.css", js=js_func) as demo:
183
  image = gr.ImageEditor(type="pil", label="Sketch your image or upload one", width=512, height=512)
184
  prompt = gr.Textbox(label="Prompt")
185
  style = gr.Dropdown(label="Style", choices=STYLE_NAMES, value=DEFAULT_STYLE_NAME)
186
- with gr.Accordion("Control options", open=False):
187
- use_openpose = gr.Checkbox(label="Use Openpose", value=False)
188
- use_depth = gr.Checkbox(label="Use Depth", value=False)
189
- use_canny = gr.Checkbox(label="Use Canny", value=False)
190
- use_lineart = gr.Checkbox(label="Use Lineart", value=False)
191
- use_anime_lineart = gr.Checkbox(label="Use Anime Lineart", value=False)
192
- use_mlsd = gr.Checkbox(label="Use MLSD", value=False)
193
- use_scribble = gr.Checkbox(label="Use Scribble", value=False)
194
- use_hed = gr.Checkbox(label="Use HED", value=False)
195
- use_softedge = gr.Checkbox(label="Use Softedge (PIDI)", value=False)
196
- use_teed = gr.Checkbox(label="Use TEED", value=False)
197
- use_segment = gr.Checkbox(label="Use Segment", value=False)
198
- use_normal = gr.Checkbox(label="Use Normal", value=False)
199
  run_button = gr.Button("Run")
200
  with gr.Accordion("Advanced options", open=False):
201
  negative_prompt = gr.Textbox(
@@ -217,7 +303,7 @@ with gr.Blocks(css="style.css", js=js_func) as demo:
217
  value=5,
218
  )
219
  controlnet_conditioning_scale = gr.Slider(
220
- label="ControlNet conditioning scale",
221
  minimum=0.5,
222
  maximum=5.0,
223
  step=0.1,
@@ -236,14 +322,6 @@ with gr.Blocks(css="style.css", js=js_func) as demo:
236
  with gr.Group():
237
  image_slider = ImageSlider(position=0.5)
238
 
239
- gr.Markdown("""
240
- ## Multi Control Visual Examples
241
- - Openpose + Canny
242
- - Openpose + Depth
243
- - Openpose + Scribble
244
- - Openpose + Normal
245
- - Openpose + Segment
246
- """)
247
 
248
  inputs = [
249
  image,
@@ -254,18 +332,8 @@ with gr.Blocks(css="style.css", js=js_func) as demo:
254
  guidance_scale,
255
  controlnet_conditioning_scale,
256
  seed,
257
- use_openpose,
258
- use_depth,
259
- use_canny,
260
- use_lineart,
261
- use_anime_lineart,
262
- use_mlsd,
263
- use_scribble,
264
  use_hed,
265
- use_softedge,
266
- use_teed,
267
- use_segment,
268
- use_normal
269
  ]
270
  outputs = [image_slider]
271
  run_button.click(
@@ -277,5 +345,7 @@ with gr.Blocks(css="style.css", js=js_func) as demo:
277
  ).then(lambda x: None, inputs=None, outputs=image_slider).then(
278
  fn=run, inputs=inputs, outputs=outputs
279
  )
 
 
280
 
281
  demo.queue().launch(show_error=True, ssl_verify=False)
 
9
 
10
  from diffusers import ControlNetModel, StableDiffusionXLControlNetPipeline, AutoencoderKL
11
  from diffusers import DDIMScheduler, EulerAncestralDiscreteScheduler
12
+ from controlnet_aux import PidiNetDetector, HEDdetector
13
  from diffusers.utils import load_image
14
  from huggingface_hub import HfApi
15
  from pathlib import Path
16
  from PIL import Image, ImageOps
17
+ import torch
18
+ import numpy as np
19
  import cv2
20
+ import os
21
+ import random
22
  import spaces
23
  from gradio_imageslider import ImageSlider
24
 
25
+ js_func = """
26
+ function refresh() {
27
+ const url = new URL(window.location);
28
+ }
29
+ """
30
+ def nms(x, t, s):
31
+ x = cv2.GaussianBlur(x.astype(np.float32), (0, 0), s)
32
+
33
+ f1 = np.array([[0, 0, 0], [1, 1, 1], [0, 0, 0]], dtype=np.uint8)
34
+ f2 = np.array([[0, 1, 0], [0, 1, 0], [0, 1, 0]], dtype=np.uint8)
35
+ f3 = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]], dtype=np.uint8)
36
+ f4 = np.array([[0, 0, 1], [0, 1, 0], [1, 0, 0]], dtype=np.uint8)
37
+
38
+ y = np.zeros_like(x)
39
+
40
+ for f in [f1, f2, f3, f4]:
41
+ np.putmask(y, cv2.dilate(x, kernel=f) == x, x)
42
+
43
+ z = np.zeros_like(y, dtype=np.uint8)
44
+ z[y > t] = 255
45
+ return z
46
+
47
+ def HWC3(x):
48
+ assert x.dtype == np.uint8
49
+ if x.ndim == 2:
50
+ x = x[:, :, None]
51
+ assert x.ndim == 3
52
+ H, W, C = x.shape
53
+ assert C == 1 or C == 3 or C == 4
54
+ if C == 3:
55
+ return x
56
+ if C == 1:
57
+ return np.concatenate([x, x, x], axis=2)
58
+ if C == 4:
59
+ color = x[:, :, 0:3].astype(np.float32)
60
+ alpha = x[:, :, 3:4].astype(np.float32) / 255.0
61
+ y = color * alpha + 255.0 * (1.0 - alpha)
62
+ y = y.clip(0, 255).astype(np.uint8)
63
+ return y
64
+
65
+ DESCRIPTION = ''''''
66
+
67
+ if not torch.cuda.is_available():
68
+ DESCRIPTION += ""
69
+
70
+ style_list = [
71
+ {
72
+ "name": "(No style)",
73
+ "prompt": "{prompt}",
74
+ "negative_prompt": "longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality",
75
+ },
76
+ {
77
+ "name": "Cinematic",
78
+ "prompt": "cinematic still {prompt} . emotional, harmonious, vignette, highly detailed, high budget, bokeh, cinemascope, moody, epic, gorgeous, film grain, grainy",
79
+ "negative_prompt": "anime, cartoon, graphic, text, painting, crayon, graphite, abstract, glitch, deformed, mutated, ugly, disfigured",
80
+ },
81
+ {
82
+ "name": "3D Model",
83
+ "prompt": "professional 3d model {prompt} . octane render, highly detailed, volumetric, dramatic lighting",
84
+ "negative_prompt": "ugly, deformed, noisy, low poly, blurry, painting",
85
+ },
86
+ {
87
+ "name": "Anime",
88
+ "prompt": "anime artwork {prompt} . anime style, key visual, vibrant, studio anime, highly detailed",
89
+ "negative_prompt": "photo, deformed, black and white, realism, disfigured, low contrast",
90
+ },
91
+ {
92
+ "name": "Digital Art",
93
+ "prompt": "concept art {prompt} . digital artwork, illustrative, painterly, matte painting, highly detailed",
94
+ "negative_prompt": "photo, photorealistic, realism, ugly",
95
+ },
96
+ {
97
+ "name": "Photographic",
98
+ "prompt": "cinematic photo {prompt} . 35mm photograph, film, bokeh, professional, 4k, highly detailed",
99
+ "negative_prompt": "drawing, painting, crayon, sketch, graphite, impressionist, noisy, blurry, soft, deformed, ugly",
100
+ },
101
+ {
102
+ "name": "Pixel art",
103
+ "prompt": "pixel-art {prompt} . low-res, blocky, pixel art style, 8-bit graphics",
104
+ "negative_prompt": "sloppy, messy, blurry, noisy, highly detailed, ultra textured, photo, realistic",
105
+ },
106
+ {
107
+ "name": "Fantasy art",
108
+ "prompt": "ethereal fantasy concept art of {prompt} . magnificent, celestial, ethereal, painterly, epic, majestic, magical, fantasy art, cover art, dreamy",
109
+ "negative_prompt": "photographic, realistic, realism, 35mm film, dslr, cropped, frame, text, deformed, glitch, noise, noisy, off-center, deformed, cross-eyed, closed eyes, bad anatomy, ugly, disfigured, sloppy, duplicate, mutated, black and white",
110
+ },
111
+ {
112
+ "name": "Neonpunk",
113
+ "prompt": "neonpunk style {prompt} . cyberpunk, vaporwave, neon, vibes, vibrant, stunningly beautiful, crisp, detailed, sleek, ultramodern, magenta highlights, dark purple shadows, high contrast, cinematic, ultra detailed, intricate, professional",
114
+ "negative_prompt": "painting, drawing, illustration, glitch, deformed, mutated, cross-eyed, ugly, disfigured",
115
+ },
116
+ {
117
+ "name": "Manga",
118
+ "prompt": "manga style {prompt} . vibrant, high-energy, detailed, iconic, Japanese comic style",
119
+ "negative_prompt": "ugly, deformed, noisy, blurry, low contrast, realism, photorealistic, Western comic style",
120
+ },
121
+ ]
122
+
123
+ styles = {k["name"]: (k["prompt"], k["negative_prompt"]) for k in style_list}
124
+ STYLE_NAMES = list(styles.keys())
125
+ DEFAULT_STYLE_NAME = "(No style)"
126
 
 
 
 
 
 
 
 
 
 
 
 
127
 
128
+ def apply_style(style_name: str, positive: str, negative: str = "") -> tuple[str, str]:
129
+ p, n = styles.get(style_name, styles[DEFAULT_STYLE_NAME])
130
+ return p.replace("{prompt}", positive), n + negative
131
+
132
+
133
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
134
+
135
+ eulera_scheduler = EulerAncestralDiscreteScheduler.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", subfolder="scheduler")
136
+
137
 
138
  controlnet = ControlNetModel.from_pretrained(
139
  "xinsir/controlnet-union-sdxl-1.0",
140
  torch_dtype=torch.float16
141
  )
142
+ controlnet_canny = ControlNetModel.from_pretrained(
143
+ "xinsir/controlnet-canny-sdxl-1.0",
144
+ torch_dtype=torch.float16
145
+ )
146
+ # when test with other base model, you need to change the vae also.
147
+ vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
148
 
149
  pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
150
  "stabilityai/stable-diffusion-xl-base-1.0",
 
154
  scheduler=eulera_scheduler,
155
  )
156
  pipe.to(device)
157
+ # Load model.
158
+ pipe_canny = StableDiffusionXLControlNetPipeline.from_pretrained(
159
+ "stabilityai/stable-diffusion-xl-base-1.0",
160
+ controlnet=controlnet_canny,
161
+ vae=vae,
162
+ safety_checker=None,
163
+ torch_dtype=torch.float16,
164
+ scheduler=eulera_scheduler,
165
+ )
166
+
167
+ pipe_canny.to(device)
168
+
169
+ MAX_SEED = np.iinfo(np.int32).max
170
+ processor = HEDdetector.from_pretrained('lllyasviel/Annotators')
171
+ def nms(x, t, s):
172
+ x = cv2.GaussianBlur(x.astype(np.float32), (0, 0), s)
173
+
174
+ f1 = np.array([[0, 0, 0], [1, 1, 1], [0, 0, 0]], dtype=np.uint8)
175
+ f2 = np.array([[0, 1, 0], [0, 1, 0], [0, 1, 0]], dtype=np.uint8)
176
+ f3 = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]], dtype=np.uint8)
177
+ f4 = np.array([[0, 0, 1], [0, 1, 0], [1, 0, 0]], dtype=np.uint8)
178
+
179
+ y = np.zeros_like(x)
180
+
181
+ for f in [f1, f2, f3, f4]:
182
+ np.putmask(y, cv2.dilate(x, kernel=f) == x, x)
183
+
184
+ z = np.zeros_like(y, dtype=np.uint8)
185
+ z[y > t] = 255
186
+ return z
187
+
188
+ def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
189
+ if randomize_seed:
190
+ seed = random.randint(0, MAX_SEED)
191
+ return seed
192
 
193
  @spaces.GPU
194
  def run(
 
200
  guidance_scale: float = 5,
201
  controlnet_conditioning_scale: float = 1.0,
202
  seed: int = 0,
 
 
 
 
 
 
 
203
  use_hed: bool = False,
204
+ use_canny: bool = False,
 
 
 
205
  progress=gr.Progress(track_tqdm=True),
206
  ) -> PIL.Image.Image:
207
+ # Get the composite image from the EditorValue dict
208
  composite_image = image['composite']
209
  width, height = composite_image.size
210
 
211
+ # Calculate new dimensions to fit within 1024x1024 while maintaining aspect ratio
212
  max_size = 1024
213
  ratio = min(max_size / width, max_size / height)
214
  new_width = int(width * ratio)
215
  new_height = int(height * ratio)
216
 
217
+ # Resize the image
218
  resized_image = composite_image.resize((new_width, new_height), Image.LANCZOS)
219
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  if use_canny:
221
+ controlnet_img = np.array(resized_image)
222
+ controlnet_img = cv2.Canny(controlnet_img, 100, 200)
223
+ controlnet_img = HWC3(controlnet_img)
224
+ image = Image.fromarray(controlnet_img)
225
+ elif not use_hed:
226
+ controlnet_img = resized_image
227
+ image = resized_image
228
+ else:
229
+ controlnet_img = processor(resized_image, scribble=False)
230
+ controlnet_img = np.array(controlnet_img)
231
+ controlnet_img = nms(controlnet_img, 127, 3)
232
+ controlnet_img = cv2.GaussianBlur(controlnet_img, (0, 0), 3)
233
+ random_val = int(round(random.uniform(0.01, 0.10), 2) * 255)
234
+ controlnet_img[controlnet_img > random_val] = 255
235
+ controlnet_img[controlnet_img < 255] = 0
236
+ image = Image.fromarray(controlnet_img)
237
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
  prompt, negative_prompt = apply_style(style_name, prompt, negative_prompt)
239
 
240
  generator = torch.Generator(device=device).manual_seed(seed)
241
 
242
+ if use_canny:
243
+ out = pipe_canny(
244
+ prompt=prompt,
245
+ negative_prompt=negative_prompt,
246
+ image=image,
247
+ num_inference_steps=num_steps,
248
+ generator=generator,
249
+ controlnet_conditioning_scale=controlnet_conditioning_scale,
250
+ guidance_scale=guidance_scale,
251
+ width=new_width,
252
+ height=new_height,
253
+ ).images[0]
254
+ else:
255
+ out = pipe(
256
+ prompt=prompt,
257
+ negative_prompt=negative_prompt,
258
+ image=image,
259
+ num_inference_steps=num_steps,
260
+ generator=generator,
261
+ controlnet_conditioning_scale=controlnet_conditioning_scale,
262
+ guidance_scale=guidance_scale,
263
+ width=new_width,
264
+ height=new_height,
265
+ ).images[0]
266
+
267
+ return (controlnet_img, out)
268
 
269
  with gr.Blocks(css="style.css", js=js_func) as demo:
270
  gr.Markdown(DESCRIPTION, elem_id="description")
 
280
  image = gr.ImageEditor(type="pil", label="Sketch your image or upload one", width=512, height=512)
281
  prompt = gr.Textbox(label="Prompt")
282
  style = gr.Dropdown(label="Style", choices=STYLE_NAMES, value=DEFAULT_STYLE_NAME)
283
+ use_hed = gr.Checkbox(label="use HED detector", value=False, info="check this box if you upload an image and want to turn it to a sketch")
284
+ use_canny = gr.Checkbox(label="use Canny", value=False, info="check this to use ControlNet canny instead of scribble")
 
 
 
 
 
 
 
 
 
 
 
285
  run_button = gr.Button("Run")
286
  with gr.Accordion("Advanced options", open=False):
287
  negative_prompt = gr.Textbox(
 
303
  value=5,
304
  )
305
  controlnet_conditioning_scale = gr.Slider(
306
+ label="controlnet conditioning scale",
307
  minimum=0.5,
308
  maximum=5.0,
309
  step=0.1,
 
322
  with gr.Group():
323
  image_slider = ImageSlider(position=0.5)
324
 
 
 
 
 
 
 
 
 
325
 
326
  inputs = [
327
  image,
 
332
  guidance_scale,
333
  controlnet_conditioning_scale,
334
  seed,
 
 
 
 
 
 
 
335
  use_hed,
336
+ use_canny
 
 
 
337
  ]
338
  outputs = [image_slider]
339
  run_button.click(
 
345
  ).then(lambda x: None, inputs=None, outputs=image_slider).then(
346
  fn=run, inputs=inputs, outputs=outputs
347
  )
348
+
349
+
350
 
351
  demo.queue().launch(show_error=True, ssl_verify=False)