Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -15,22 +15,6 @@ from gradio_imageslider import ImageSlider
|
|
15 |
|
16 |
print(f'torch version:{torch.__version__}')
|
17 |
|
18 |
-
# import subprocess
|
19 |
-
# import importlib, site, sys
|
20 |
-
|
21 |
-
# # Re-discover all .pth/.egg-link files
|
22 |
-
# for sitedir in site.getsitepackages():
|
23 |
-
# site.addsitedir(sitedir)
|
24 |
-
|
25 |
-
# # Clear caches so importlib will pick up new modules
|
26 |
-
# importlib.invalidate_caches()
|
27 |
-
|
28 |
-
# def sh(cmd): subprocess.check_call(cmd, shell=True)
|
29 |
-
|
30 |
-
# sh("pip install -U xformers --index-url https://download.pytorch.org/whl/cu126")
|
31 |
-
|
32 |
-
# # tell Python to re-scan site-packages now that the egg-link exists
|
33 |
-
# import importlib, site; site.addsitedir(site.getsitepackages()[0]); importlib.invalidate_caches()
|
34 |
|
35 |
import torch.utils.checkpoint
|
36 |
from pytorch_lightning import seed_everything
|
@@ -192,10 +176,6 @@ tag_model.to(device, dtype=weight_dtype)
|
|
192 |
def process(
|
193 |
input_image: Image.Image,
|
194 |
user_prompt: str,
|
195 |
-
use_KDS: bool,
|
196 |
-
bandwidth: float,
|
197 |
-
patch_size: int,
|
198 |
-
num_particles: int,
|
199 |
positive_prompt: str,
|
200 |
negative_prompt: str,
|
201 |
num_inference_steps: int,
|
@@ -254,7 +234,6 @@ def process(
|
|
254 |
guidance_scale=cfg_scale, conditioning_scale=1,
|
255 |
start_point='lr', start_steps=999,ram_encoder_hidden_states=ram_encoder_hidden_states,
|
256 |
latent_tiled_size=latent_tiled_size, latent_tiled_overlap=latent_tiled_overlap,
|
257 |
-
use_KDS=use_KDS, bandwidth=bandwidth, num_particles=num_particles, patch_size=patch_size,
|
258 |
).images[0]
|
259 |
|
260 |
if True: # alpha<1.0:
|
@@ -315,61 +294,6 @@ with block:
|
|
315 |
[
|
316 |
"preset/datasets/test_datasets/man.png",
|
317 |
"",
|
318 |
-
False,
|
319 |
-
0.1,
|
320 |
-
4,
|
321 |
-
4,
|
322 |
-
"clean, high-resolution, 8k, best quality, masterpiece",
|
323 |
-
"dotted, noise, blur, lowres, oversmooth, longbody, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality",
|
324 |
-
50,
|
325 |
-
4,
|
326 |
-
7.5,
|
327 |
-
123,
|
328 |
-
320,
|
329 |
-
4,
|
330 |
-
1,
|
331 |
-
],
|
332 |
-
[
|
333 |
-
"preset/datasets/test_datasets/man.png",
|
334 |
-
"",
|
335 |
-
True,
|
336 |
-
0.1,
|
337 |
-
16,
|
338 |
-
4,
|
339 |
-
"clean, high-resolution, 8k, best quality, masterpiece",
|
340 |
-
"dotted, noise, blur, lowres, oversmooth, longbody, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality",
|
341 |
-
50,
|
342 |
-
4,
|
343 |
-
7.5,
|
344 |
-
123,
|
345 |
-
320,
|
346 |
-
4,
|
347 |
-
1,
|
348 |
-
],
|
349 |
-
[
|
350 |
-
"preset/datasets/test_datasets/man.png",
|
351 |
-
"",
|
352 |
-
True,
|
353 |
-
0.1,
|
354 |
-
4,
|
355 |
-
16,
|
356 |
-
"clean, high-resolution, 8k, best quality, masterpiece",
|
357 |
-
"dotted, noise, blur, lowres, oversmooth, longbody, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality",
|
358 |
-
50,
|
359 |
-
4,
|
360 |
-
7.5,
|
361 |
-
123,
|
362 |
-
320,
|
363 |
-
4,
|
364 |
-
1,
|
365 |
-
],
|
366 |
-
[
|
367 |
-
"preset/datasets/test_datasets/man.png",
|
368 |
-
"",
|
369 |
-
True,
|
370 |
-
0.1,
|
371 |
-
16,
|
372 |
-
16,
|
373 |
"clean, high-resolution, 8k, best quality, masterpiece",
|
374 |
"dotted, noise, blur, lowres, oversmooth, longbody, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality",
|
375 |
50,
|
@@ -379,15 +303,11 @@ with block:
|
|
379 |
320,
|
380 |
4,
|
381 |
1,
|
382 |
-
],
|
383 |
],
|
384 |
inputs=[
|
385 |
input_image,
|
386 |
user_prompt,
|
387 |
-
use_KDS,
|
388 |
-
bandwidth,
|
389 |
-
patch_size,
|
390 |
-
num_particles,
|
391 |
positive_prompt,
|
392 |
negative_prompt,
|
393 |
num_inference_steps,
|
@@ -405,10 +325,6 @@ with block:
|
|
405 |
inputs = [
|
406 |
input_image,
|
407 |
user_prompt,
|
408 |
-
use_KDS,
|
409 |
-
bandwidth,
|
410 |
-
patch_size,
|
411 |
-
num_particles,
|
412 |
positive_prompt,
|
413 |
negative_prompt,
|
414 |
num_inference_steps,
|
|
|
15 |
|
16 |
print(f'torch version:{torch.__version__}')
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
import torch.utils.checkpoint
|
20 |
from pytorch_lightning import seed_everything
|
|
|
176 |
def process(
|
177 |
input_image: Image.Image,
|
178 |
user_prompt: str,
|
|
|
|
|
|
|
|
|
179 |
positive_prompt: str,
|
180 |
negative_prompt: str,
|
181 |
num_inference_steps: int,
|
|
|
234 |
guidance_scale=cfg_scale, conditioning_scale=1,
|
235 |
start_point='lr', start_steps=999,ram_encoder_hidden_states=ram_encoder_hidden_states,
|
236 |
latent_tiled_size=latent_tiled_size, latent_tiled_overlap=latent_tiled_overlap,
|
|
|
237 |
).images[0]
|
238 |
|
239 |
if True: # alpha<1.0:
|
|
|
294 |
[
|
295 |
"preset/datasets/test_datasets/man.png",
|
296 |
"",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
297 |
"clean, high-resolution, 8k, best quality, masterpiece",
|
298 |
"dotted, noise, blur, lowres, oversmooth, longbody, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality",
|
299 |
50,
|
|
|
303 |
320,
|
304 |
4,
|
305 |
1,
|
306 |
+
],
|
307 |
],
|
308 |
inputs=[
|
309 |
input_image,
|
310 |
user_prompt,
|
|
|
|
|
|
|
|
|
311 |
positive_prompt,
|
312 |
negative_prompt,
|
313 |
num_inference_steps,
|
|
|
325 |
inputs = [
|
326 |
input_image,
|
327 |
user_prompt,
|
|
|
|
|
|
|
|
|
328 |
positive_prompt,
|
329 |
negative_prompt,
|
330 |
num_inference_steps,
|