Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ from PIL import Image
|
|
5 |
import spaces
|
6 |
import torch
|
7 |
from huggingface_hub import hf_hub_download, HfApi
|
8 |
-
from diffusers import FluxPriorReduxPipeline, FluxPipeline
|
9 |
from diffusers.utils import load_image
|
10 |
import os
|
11 |
api = HfApi(
|
@@ -13,11 +13,17 @@ api = HfApi(
|
|
13 |
)
|
14 |
MAX_SEED = np.iinfo(np.int32).max
|
15 |
MAX_IMAGE_SIZE = 2048
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
17 |
pipe = FluxPipeline.from_pretrained(
|
18 |
"LPX55/FLUX.1-merged_uncensored",
|
19 |
torch_dtype=torch.bfloat16,
|
20 |
token=os.getenv('HF_TOKEN'),
|
|
|
21 |
).to("cuda")
|
22 |
pipe.load_lora_weights(hf_hub_download("ByteDance/Hyper-SD", "Hyper-FLUX.1-dev-8steps-lora.safetensors"), lora_scale=0.125)
|
23 |
pipe.fuse_lora(lora_scale=0.125)
|
|
|
5 |
import spaces
|
6 |
import torch
|
7 |
from huggingface_hub import hf_hub_download, HfApi
|
8 |
+
from diffusers import FluxPriorReduxPipeline, FluxPipeline, AutoencoderKL
|
9 |
from diffusers.utils import load_image
|
10 |
import os
|
11 |
api = HfApi(
|
|
|
13 |
)
|
14 |
MAX_SEED = np.iinfo(np.int32).max
|
15 |
MAX_IMAGE_SIZE = 2048
|
16 |
+
good_vae = AutoencoderKL.from_pretrained("black-forest-labs/FLUX.1-dev",
|
17 |
+
subfolder="vae",
|
18 |
+
torch_dtype=torch.bfloat16,
|
19 |
+
use_safetensors=True,
|
20 |
+
token=HF_TOKEN
|
21 |
+
).to("cuda")
|
22 |
pipe = FluxPipeline.from_pretrained(
|
23 |
"LPX55/FLUX.1-merged_uncensored",
|
24 |
torch_dtype=torch.bfloat16,
|
25 |
token=os.getenv('HF_TOKEN'),
|
26 |
+
vae=good_vae
|
27 |
).to("cuda")
|
28 |
pipe.load_lora_weights(hf_hub_download("ByteDance/Hyper-SD", "Hyper-FLUX.1-dev-8steps-lora.safetensors"), lora_scale=0.125)
|
29 |
pipe.fuse_lora(lora_scale=0.125)
|