Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,8 +7,10 @@ from diffusers import AutoPipelineForInpainting, UNet2DConditionModel
|
|
| 7 |
import diffusers
|
| 8 |
from share_btn import community_icon_html, loading_icon_html, share_js
|
| 9 |
|
|
|
|
|
|
|
| 10 |
vae = AutoencoderKL.from_pretrained("stabilityai/sd-vae-ft-mse")
|
| 11 |
-
pipe = AutoPipelineForInpainting.from_pretrained("SG161222/Realistic_Vision_V5.0_noVAE",vae=vae).to("cuda")
|
| 12 |
|
| 13 |
def read_content(file_path: str) -> str:
|
| 14 |
"""read the content of target file
|
|
@@ -30,7 +32,9 @@ def predict(dict, prompt="", negative_prompt="", guidance_scale=7.5, steps=30, s
|
|
| 30 |
add_kwargs["algorithm_type"] = "sde-dpmsolver++"
|
| 31 |
|
| 32 |
scheduler = getattr(diffusers, scheduler_class_name)
|
| 33 |
-
pipe.scheduler = scheduler.from_pretrained("
|
|
|
|
|
|
|
| 34 |
|
| 35 |
init_image = dict["image"]
|
| 36 |
mask_image = dict["mask"]
|
|
|
|
| 7 |
import diffusers
|
| 8 |
from share_btn import community_icon_html, loading_icon_html, share_js
|
| 9 |
|
| 10 |
+
unet = UNet2DConditionModel.from_config("SG161222/Realistic_Vision_V5.0_noVAE", subfolder="unet").to("cuda", torch.float16)
|
| 11 |
+
unet.load_state_dict(load_file(hf_hub_download("ByteDance/SDXL-Lightning", "sdxl_lightning_2step_unet.safetensors"), device="cuda"))
|
| 12 |
vae = AutoencoderKL.from_pretrained("stabilityai/sd-vae-ft-mse")
|
| 13 |
+
pipe = AutoPipelineForInpainting.from_pretrained("SG161222/Realistic_Vision_V5.0_noVAE",unet=unet,vae=vae).to("cuda")
|
| 14 |
|
| 15 |
def read_content(file_path: str) -> str:
|
| 16 |
"""read the content of target file
|
|
|
|
| 32 |
add_kwargs["algorithm_type"] = "sde-dpmsolver++"
|
| 33 |
|
| 34 |
scheduler = getattr(diffusers, scheduler_class_name)
|
| 35 |
+
pipe.scheduler = scheduler.from_pretrained("SG161222/Realistic_Vision_V5.0_noVAE", subfolder="scheduler", **add_kwargs)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
|
| 39 |
init_image = dict["image"]
|
| 40 |
mask_image = dict["mask"]
|