Spaces:
Runtime error
Runtime error
add anyline params
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import spaces
|
|
2 |
import gradio as gr
|
3 |
from gradio_imageslider import ImageSlider
|
4 |
import torch
|
|
|
5 |
torch.jit.script = lambda f: f
|
6 |
from hidiffusion import apply_hidiffusion
|
7 |
from diffusers import (
|
@@ -100,6 +101,8 @@ def predict(
|
|
100 |
strength=1.0,
|
101 |
controlnet_start=0.0,
|
102 |
controlnet_end=1.0,
|
|
|
|
|
103 |
progress=gr.Progress(track_tqdm=True),
|
104 |
):
|
105 |
if IS_SPACES_ZERO:
|
@@ -110,7 +113,13 @@ def predict(
|
|
110 |
conditioning, pooled = compel([prompt, negative_prompt])
|
111 |
generator = torch.manual_seed(seed)
|
112 |
last_time = time.time()
|
113 |
-
anyline_image = anyline(
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
images = pipe(
|
115 |
image=padded_image,
|
116 |
control_image=anyline_image,
|
@@ -222,6 +231,20 @@ SDXL Controlnet [TheMistoAI/MistoLine](https://huggingface.co/TheMistoAI/MistoLi
|
|
222 |
value=1.0,
|
223 |
label="ControlNet End",
|
224 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
|
226 |
btn = gr.Button()
|
227 |
with gr.Column(scale=2):
|
@@ -241,6 +264,8 @@ SDXL Controlnet [TheMistoAI/MistoLine](https://huggingface.co/TheMistoAI/MistoLi
|
|
241 |
strength,
|
242 |
controlnet_start,
|
243 |
controlnet_end,
|
|
|
|
|
244 |
]
|
245 |
outputs = [image_slider, padded_image, anyline_image]
|
246 |
btn.click(lambda x: None, inputs=None, outputs=image_slider).then(
|
@@ -261,7 +286,9 @@ SDXL Controlnet [TheMistoAI/MistoLine](https://huggingface.co/TheMistoAI/MistoLi
|
|
261 |
0.8,
|
262 |
1.0,
|
263 |
0.0,
|
264 |
-
|
|
|
|
|
265 |
],
|
266 |
[
|
267 |
"./examples/cybetruck.jpeg",
|
@@ -273,7 +300,9 @@ SDXL Controlnet [TheMistoAI/MistoLine](https://huggingface.co/TheMistoAI/MistoLi
|
|
273 |
0.8,
|
274 |
0.8,
|
275 |
0.0,
|
276 |
-
|
|
|
|
|
277 |
],
|
278 |
[
|
279 |
"./examples/jesus.png",
|
@@ -285,7 +314,9 @@ SDXL Controlnet [TheMistoAI/MistoLine](https://huggingface.co/TheMistoAI/MistoLi
|
|
285 |
0.8,
|
286 |
0.8,
|
287 |
0.0,
|
288 |
-
|
|
|
|
|
289 |
],
|
290 |
[
|
291 |
"./examples/anna-sullivan-DioLM8ViiO8-unsplash.jpg",
|
@@ -297,7 +328,9 @@ SDXL Controlnet [TheMistoAI/MistoLine](https://huggingface.co/TheMistoAI/MistoLi
|
|
297 |
0.8,
|
298 |
0.8,
|
299 |
0.0,
|
300 |
-
|
|
|
|
|
301 |
],
|
302 |
[
|
303 |
"./examples/img_aef651cb-2919-499d-aa49-6d4e2e21a56e_1024.jpg",
|
@@ -309,7 +342,9 @@ SDXL Controlnet [TheMistoAI/MistoLine](https://huggingface.co/TheMistoAI/MistoLi
|
|
309 |
0.8,
|
310 |
0.8,
|
311 |
0.0,
|
312 |
-
|
|
|
|
|
313 |
],
|
314 |
[
|
315 |
"./examples/huggingface.jpg",
|
@@ -321,7 +356,9 @@ SDXL Controlnet [TheMistoAI/MistoLine](https://huggingface.co/TheMistoAI/MistoLi
|
|
321 |
0.364,
|
322 |
0.8,
|
323 |
0.0,
|
324 |
-
|
|
|
|
|
325 |
],
|
326 |
],
|
327 |
cache_examples="lazy",
|
|
|
2 |
import gradio as gr
|
3 |
from gradio_imageslider import ImageSlider
|
4 |
import torch
|
5 |
+
|
6 |
torch.jit.script = lambda f: f
|
7 |
from hidiffusion import apply_hidiffusion
|
8 |
from diffusers import (
|
|
|
101 |
strength=1.0,
|
102 |
controlnet_start=0.0,
|
103 |
controlnet_end=1.0,
|
104 |
+
guassian_sigma=2.0,
|
105 |
+
intensity_threshold=3,
|
106 |
progress=gr.Progress(track_tqdm=True),
|
107 |
):
|
108 |
if IS_SPACES_ZERO:
|
|
|
113 |
conditioning, pooled = compel([prompt, negative_prompt])
|
114 |
generator = torch.manual_seed(seed)
|
115 |
last_time = time.time()
|
116 |
+
anyline_image = anyline(
|
117 |
+
padded_image,
|
118 |
+
detect_resolution=1280,
|
119 |
+
guassian_sigma=max(0.01, guassian_sigma),
|
120 |
+
intensity_threshold=intensity_threshold,
|
121 |
+
)
|
122 |
+
|
123 |
images = pipe(
|
124 |
image=padded_image,
|
125 |
control_image=anyline_image,
|
|
|
231 |
value=1.0,
|
232 |
label="ControlNet End",
|
233 |
)
|
234 |
+
guassian_sigma = gr.Slider(
|
235 |
+
minimum=0.01,
|
236 |
+
maximum=10.0,
|
237 |
+
step=0.1,
|
238 |
+
value=2.0,
|
239 |
+
label="(Anyline) Guassian Sigma",
|
240 |
+
)
|
241 |
+
intensity_threshold = gr.Slider(
|
242 |
+
minimum=0,
|
243 |
+
maximum=255,
|
244 |
+
step=1,
|
245 |
+
value=3,
|
246 |
+
label="(Anyline) Intensity Threshold",
|
247 |
+
)
|
248 |
|
249 |
btn = gr.Button()
|
250 |
with gr.Column(scale=2):
|
|
|
264 |
strength,
|
265 |
controlnet_start,
|
266 |
controlnet_end,
|
267 |
+
guassian_sigma,
|
268 |
+
intensity_threshold,
|
269 |
]
|
270 |
outputs = [image_slider, padded_image, anyline_image]
|
271 |
btn.click(lambda x: None, inputs=None, outputs=image_slider).then(
|
|
|
286 |
0.8,
|
287 |
1.0,
|
288 |
0.0,
|
289 |
+
0.9,
|
290 |
+
2,
|
291 |
+
3,
|
292 |
],
|
293 |
[
|
294 |
"./examples/cybetruck.jpeg",
|
|
|
300 |
0.8,
|
301 |
0.8,
|
302 |
0.0,
|
303 |
+
0.9,
|
304 |
+
2,
|
305 |
+
3,
|
306 |
],
|
307 |
[
|
308 |
"./examples/jesus.png",
|
|
|
314 |
0.8,
|
315 |
0.8,
|
316 |
0.0,
|
317 |
+
0.9,
|
318 |
+
2,
|
319 |
+
3,
|
320 |
],
|
321 |
[
|
322 |
"./examples/anna-sullivan-DioLM8ViiO8-unsplash.jpg",
|
|
|
328 |
0.8,
|
329 |
0.8,
|
330 |
0.0,
|
331 |
+
0.9,
|
332 |
+
2,
|
333 |
+
3,
|
334 |
],
|
335 |
[
|
336 |
"./examples/img_aef651cb-2919-499d-aa49-6d4e2e21a56e_1024.jpg",
|
|
|
342 |
0.8,
|
343 |
0.8,
|
344 |
0.0,
|
345 |
+
0.9,
|
346 |
+
2,
|
347 |
+
3,
|
348 |
],
|
349 |
[
|
350 |
"./examples/huggingface.jpg",
|
|
|
356 |
0.364,
|
357 |
0.8,
|
358 |
0.0,
|
359 |
+
0.9,
|
360 |
+
2,
|
361 |
+
3,
|
362 |
],
|
363 |
],
|
364 |
cache_examples="lazy",
|