Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -40,9 +40,9 @@ DEFAULT_STYLE_NAME = "Japanese Anime"
|
|
40 |
global models_dict
|
41 |
use_va = True
|
42 |
models_dict = {
|
43 |
-
|
44 |
-
"RealVision": "SG161222/RealVisXL_V4.0" ,
|
45 |
-
|
46 |
# "Unstable": "stablediffusionapi/sdxl-unstable-diffusers-y"
|
47 |
}
|
48 |
photomaker_path = hf_hub_download(repo_id="TencentARC/PhotoMaker", filename="photomaker-v1.bin", repo_type="model")
|
@@ -436,7 +436,7 @@ use_safetensors= False
|
|
436 |
# pipe1.scheduler.set_timesteps(50)
|
437 |
###
|
438 |
pipe2 = PhotoMakerStableDiffusionXLPipeline.from_pretrained(
|
439 |
-
models_dict["
|
440 |
pipe2 = pipe2.to("cpu")
|
441 |
pipe2.load_photomaker_adapter(
|
442 |
os.path.dirname(photomaker_path),
|
@@ -520,7 +520,7 @@ def process_generation(_sd_type,_model_type,_upload_images, _num_steps,style_nam
|
|
520 |
num_steps =_num_steps
|
521 |
use_safe_tensor = True
|
522 |
if style_name == "(No style)":
|
523 |
-
sd_model_path = models_dict["
|
524 |
if _model_type == "original":
|
525 |
pipe = StableDiffusionXLPipeline.from_pretrained(sd_model_path, torch_dtype=torch.float16)
|
526 |
pipe = pipe.to(device)
|
@@ -529,7 +529,7 @@ def process_generation(_sd_type,_model_type,_upload_images, _num_steps,style_nam
|
|
529 |
# pipe.scheduler.set_timesteps(50)
|
530 |
set_attention_processor(pipe.unet,id_length_,is_ipadapter = False)
|
531 |
elif _model_type == "Photomaker":
|
532 |
-
if _sd_type != "
|
533 |
pipe = pipe2.to(device)
|
534 |
pipe.id_encoder.to(device)
|
535 |
set_attention_processor(pipe.unet,id_length_,is_ipadapter = False)
|
|
|
40 |
global models_dict
|
41 |
use_va = True
|
42 |
models_dict = {
|
43 |
+
"Juggernaut": "RunDiffusion/Juggernaut-XL-v8",
|
44 |
+
# "RealVision": "SG161222/RealVisXL_V4.0" ,
|
45 |
+
"SDXL":"stabilityai/stable-diffusion-xl-base-1.0" ,
|
46 |
# "Unstable": "stablediffusionapi/sdxl-unstable-diffusers-y"
|
47 |
}
|
48 |
photomaker_path = hf_hub_download(repo_id="TencentARC/PhotoMaker", filename="photomaker-v1.bin", repo_type="model")
|
|
|
436 |
# pipe1.scheduler.set_timesteps(50)
|
437 |
###
|
438 |
pipe2 = PhotoMakerStableDiffusionXLPipeline.from_pretrained(
|
439 |
+
models_dict["Juggernaut"], torch_dtype=torch.float16, use_safetensors=use_safetensors)
|
440 |
pipe2 = pipe2.to("cpu")
|
441 |
pipe2.load_photomaker_adapter(
|
442 |
os.path.dirname(photomaker_path),
|
|
|
520 |
num_steps =_num_steps
|
521 |
use_safe_tensor = True
|
522 |
if style_name == "(No style)":
|
523 |
+
sd_model_path = models_dict["Juggernaut"]
|
524 |
if _model_type == "original":
|
525 |
pipe = StableDiffusionXLPipeline.from_pretrained(sd_model_path, torch_dtype=torch.float16)
|
526 |
pipe = pipe.to(device)
|
|
|
529 |
# pipe.scheduler.set_timesteps(50)
|
530 |
set_attention_processor(pipe.unet,id_length_,is_ipadapter = False)
|
531 |
elif _model_type == "Photomaker":
|
532 |
+
if _sd_type != "Juggernaut" and style_name != "(No style)":
|
533 |
pipe = pipe2.to(device)
|
534 |
pipe.id_encoder.to(device)
|
535 |
set_attention_processor(pipe.unet,id_length_,is_ipadapter = False)
|