Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files
mod.py
CHANGED
|
@@ -24,7 +24,9 @@ models = [
|
|
| 24 |
"John6666/copycat-flux-test-fp8-v11-fp8-flux",
|
| 25 |
"John6666/nepotism-fuxdevschnell-v3aio-fp8-flux",
|
| 26 |
"John6666/niji-style-flux-devfp8-fp8-flux",
|
|
|
|
| 27 |
"John6666/lyh-dalle-anime-v12dalle-fp8-flux",
|
|
|
|
| 28 |
"John6666/fluxunchained-artfulnsfw-fut516xfp8e4m3fnv11-fp8-flux",
|
| 29 |
"John6666/fastflux-unchained-t5f16-fp8-flux",
|
| 30 |
"John6666/iniverse-mix-xl-sfwnsfw-fluxdfp8v10-fp8-flux",
|
|
@@ -164,12 +166,11 @@ def get_control_params():
|
|
| 164 |
|
| 165 |
from preprocessor import Preprocessor
|
| 166 |
def preprocess_image(image: Image.Image, control_mode: str, height: int, width: int,
|
| 167 |
-
preprocess_resolution: int
|
| 168 |
if control_mode == "None": return image
|
| 169 |
image_resolution = max(width, height)
|
| 170 |
image_before = resize_image(expand2square(image.convert("RGB")), image_resolution, image_resolution, False)
|
| 171 |
# generated control_
|
| 172 |
-
progress(0, desc="start to generate control image")
|
| 173 |
print("start to generate control image")
|
| 174 |
preprocessor = Preprocessor()
|
| 175 |
if control_mode == "depth_midas":
|
|
@@ -221,7 +222,6 @@ def preprocess_image(image: Image.Image, control_mode: str, height: int, width:
|
|
| 221 |
|
| 222 |
image_after = resize_image(control_image, width, height, False)
|
| 223 |
ref_width, ref_height = image.size
|
| 224 |
-
progress(1, desc=f"generate control image success: {ref_width}x{ref_height} => {image_width}x{image_height}")
|
| 225 |
print(f"generate control image success: {ref_width}x{ref_height} => {image_width}x{image_height}")
|
| 226 |
return image_after
|
| 227 |
|
|
@@ -271,9 +271,8 @@ def get_trigger_word(lorajson: list[dict]):
|
|
| 271 |
|
| 272 |
# https://huggingface.co/docs/diffusers/v0.23.1/en/api/loaders#diffusers.loaders.LoraLoaderMixin.fuse_lora
|
| 273 |
# https://github.com/huggingface/diffusers/issues/4919
|
| 274 |
-
def fuse_loras(pipe, lorajson: list[dict]
|
| 275 |
if not lorajson or not isinstance(lorajson, list): return
|
| 276 |
-
progress(0, desc="Fusing LoRA.")
|
| 277 |
a_list = []
|
| 278 |
w_list = []
|
| 279 |
for d in lorajson:
|
|
|
|
| 24 |
"John6666/copycat-flux-test-fp8-v11-fp8-flux",
|
| 25 |
"John6666/nepotism-fuxdevschnell-v3aio-fp8-flux",
|
| 26 |
"John6666/niji-style-flux-devfp8-fp8-flux",
|
| 27 |
+
"John6666/niji56-style-v3-fp8-flux",
|
| 28 |
"John6666/lyh-dalle-anime-v12dalle-fp8-flux",
|
| 29 |
+
"John6666/xe-hentai-flux-01-fp8-flux",
|
| 30 |
"John6666/fluxunchained-artfulnsfw-fut516xfp8e4m3fnv11-fp8-flux",
|
| 31 |
"John6666/fastflux-unchained-t5f16-fp8-flux",
|
| 32 |
"John6666/iniverse-mix-xl-sfwnsfw-fluxdfp8v10-fp8-flux",
|
|
|
|
| 166 |
|
| 167 |
from preprocessor import Preprocessor
|
| 168 |
def preprocess_image(image: Image.Image, control_mode: str, height: int, width: int,
|
| 169 |
+
preprocess_resolution: int):
|
| 170 |
if control_mode == "None": return image
|
| 171 |
image_resolution = max(width, height)
|
| 172 |
image_before = resize_image(expand2square(image.convert("RGB")), image_resolution, image_resolution, False)
|
| 173 |
# generated control_
|
|
|
|
| 174 |
print("start to generate control image")
|
| 175 |
preprocessor = Preprocessor()
|
| 176 |
if control_mode == "depth_midas":
|
|
|
|
| 222 |
|
| 223 |
image_after = resize_image(control_image, width, height, False)
|
| 224 |
ref_width, ref_height = image.size
|
|
|
|
| 225 |
print(f"generate control image success: {ref_width}x{ref_height} => {image_width}x{image_height}")
|
| 226 |
return image_after
|
| 227 |
|
|
|
|
| 271 |
|
| 272 |
# https://huggingface.co/docs/diffusers/v0.23.1/en/api/loaders#diffusers.loaders.LoraLoaderMixin.fuse_lora
|
| 273 |
# https://github.com/huggingface/diffusers/issues/4919
|
| 274 |
+
def fuse_loras(pipe, lorajson: list[dict]):
|
| 275 |
if not lorajson or not isinstance(lorajson, list): return
|
|
|
|
| 276 |
a_list = []
|
| 277 |
w_list = []
|
| 278 |
for d in lorajson:
|