Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -192,6 +192,10 @@ tag_model.to(device, dtype=weight_dtype)
|
|
| 192 |
def process(
|
| 193 |
input_image: Image.Image,
|
| 194 |
user_prompt: str,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
positive_prompt: str,
|
| 196 |
negative_prompt: str,
|
| 197 |
num_inference_steps: int,
|
|
@@ -208,15 +212,13 @@ def process(
|
|
| 208 |
])
|
| 209 |
|
| 210 |
|
| 211 |
-
|
| 212 |
vlm_model=vlm_model,
|
| 213 |
vlm_processor=vlm_processor,
|
| 214 |
process_vision_info=process_vision_info,
|
| 215 |
pil_image=input_image,
|
| 216 |
device=device,
|
| 217 |
)
|
| 218 |
-
|
| 219 |
-
print(f'oh lala, prompt tag:{prompt_tag}')
|
| 220 |
|
| 221 |
# with torch.no_grad():
|
| 222 |
seed_everything(seed)
|
|
@@ -253,7 +255,8 @@ def process(
|
|
| 253 |
height=height, width=width,
|
| 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 |
).images[0]
|
| 258 |
|
| 259 |
if True: # alpha<1.0:
|
|
@@ -312,9 +315,12 @@ with block:
|
|
| 312 |
examples = gr.Examples(
|
| 313 |
examples=[
|
| 314 |
[
|
| 315 |
-
"preset/datasets/test_datasets/
|
| 316 |
"",
|
| 317 |
False,
|
|
|
|
|
|
|
|
|
|
| 318 |
"clean, high-resolution, 8k, best quality, masterpiece",
|
| 319 |
"dotted, noise, blur, lowres, oversmooth, longbody, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality",
|
| 320 |
50,
|
|
@@ -324,11 +330,14 @@ with block:
|
|
| 324 |
320,
|
| 325 |
4,
|
| 326 |
1,
|
| 327 |
-
],
|
| 328 |
[
|
| 329 |
-
"preset/datasets/test_datasets/
|
| 330 |
"",
|
| 331 |
-
|
|
|
|
|
|
|
|
|
|
| 332 |
"clean, high-resolution, 8k, best quality, masterpiece",
|
| 333 |
"dotted, noise, blur, lowres, oversmooth, longbody, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality",
|
| 334 |
50,
|
|
@@ -338,11 +347,32 @@ with block:
|
|
| 338 |
320,
|
| 339 |
4,
|
| 340 |
1,
|
| 341 |
-
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 342 |
],
|
| 343 |
inputs=[
|
| 344 |
input_image,
|
| 345 |
user_prompt,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 346 |
positive_prompt,
|
| 347 |
negative_prompt,
|
| 348 |
num_inference_steps,
|
|
@@ -360,6 +390,10 @@ with block:
|
|
| 360 |
inputs = [
|
| 361 |
input_image,
|
| 362 |
user_prompt,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 363 |
positive_prompt,
|
| 364 |
negative_prompt,
|
| 365 |
num_inference_steps,
|
|
@@ -373,4 +407,3 @@ with block:
|
|
| 373 |
run_button.click(fn=process, inputs=inputs, outputs=[result_gallery])
|
| 374 |
|
| 375 |
block.launch(share=True)
|
| 376 |
-
|
|
|
|
| 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,
|
|
|
|
| 212 |
])
|
| 213 |
|
| 214 |
|
| 215 |
+
user_prompt = _generate_vlm_prompt(
|
| 216 |
vlm_model=vlm_model,
|
| 217 |
vlm_processor=vlm_processor,
|
| 218 |
process_vision_info=process_vision_info,
|
| 219 |
pil_image=input_image,
|
| 220 |
device=device,
|
| 221 |
)
|
|
|
|
|
|
|
| 222 |
|
| 223 |
# with torch.no_grad():
|
| 224 |
seed_everything(seed)
|
|
|
|
| 255 |
height=height, width=width,
|
| 256 |
guidance_scale=cfg_scale, conditioning_scale=1,
|
| 257 |
start_point='lr', start_steps=999,ram_encoder_hidden_states=ram_encoder_hidden_states,
|
| 258 |
+
latent_tiled_size=latent_tiled_size, latent_tiled_overlap=latent_tiled_overlap,
|
| 259 |
+
use_KDS=use_KDS, bandwidth=bandwidth, num_particles=num_particles, patch_size=patch_size,
|
| 260 |
).images[0]
|
| 261 |
|
| 262 |
if True: # alpha<1.0:
|
|
|
|
| 315 |
examples = gr.Examples(
|
| 316 |
examples=[
|
| 317 |
[
|
| 318 |
+
"preset/datasets/test_datasets/man.png",
|
| 319 |
"",
|
| 320 |
False,
|
| 321 |
+
0.1,
|
| 322 |
+
4,
|
| 323 |
+
4,
|
| 324 |
"clean, high-resolution, 8k, best quality, masterpiece",
|
| 325 |
"dotted, noise, blur, lowres, oversmooth, longbody, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality",
|
| 326 |
50,
|
|
|
|
| 330 |
320,
|
| 331 |
4,
|
| 332 |
1,
|
| 333 |
+
],
|
| 334 |
[
|
| 335 |
+
"preset/datasets/test_datasets/man.png",
|
| 336 |
"",
|
| 337 |
+
True,
|
| 338 |
+
0.1,
|
| 339 |
+
16,
|
| 340 |
+
4,
|
| 341 |
"clean, high-resolution, 8k, best quality, masterpiece",
|
| 342 |
"dotted, noise, blur, lowres, oversmooth, longbody, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality",
|
| 343 |
50,
|
|
|
|
| 347 |
320,
|
| 348 |
4,
|
| 349 |
1,
|
| 350 |
+
],
|
| 351 |
+
[
|
| 352 |
+
"preset/datasets/test_datasets/man.png",
|
| 353 |
+
"",
|
| 354 |
+
True,
|
| 355 |
+
0.1,
|
| 356 |
+
4,
|
| 357 |
+
4,
|
| 358 |
+
"clean, high-resolution, 8k, best quality, masterpiece",
|
| 359 |
+
"dotted, noise, blur, lowres, oversmooth, longbody, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality",
|
| 360 |
+
50,
|
| 361 |
+
4,
|
| 362 |
+
7.5,
|
| 363 |
+
123,
|
| 364 |
+
320,
|
| 365 |
+
4,
|
| 366 |
+
1,
|
| 367 |
+
],
|
| 368 |
],
|
| 369 |
inputs=[
|
| 370 |
input_image,
|
| 371 |
user_prompt,
|
| 372 |
+
use_KDS,
|
| 373 |
+
bandwidth,
|
| 374 |
+
patch_size,
|
| 375 |
+
num_particles,
|
| 376 |
positive_prompt,
|
| 377 |
negative_prompt,
|
| 378 |
num_inference_steps,
|
|
|
|
| 390 |
inputs = [
|
| 391 |
input_image,
|
| 392 |
user_prompt,
|
| 393 |
+
use_KDS,
|
| 394 |
+
bandwidth,
|
| 395 |
+
patch_size,
|
| 396 |
+
num_particles,
|
| 397 |
positive_prompt,
|
| 398 |
negative_prompt,
|
| 399 |
num_inference_steps,
|
|
|
|
| 407 |
run_button.click(fn=process, inputs=inputs, outputs=[result_gallery])
|
| 408 |
|
| 409 |
block.launch(share=True)
|
|
|