Spaces:
Running on Zero
Running on Zero
Upload 4 files
Browse files- README.md +4 -2
- app.py +6 -4
- lustifyWorkflowsKrea2_krea2Edit.json +3 -3
- test_app.py +3 -1
README.md
CHANGED
|
@@ -28,11 +28,13 @@ in that mode.
|
|
| 28 |
|
| 29 |
## Models
|
| 30 |
|
| 31 |
-
The
|
|
|
|
|
|
|
| 32 |
|
| 33 |
| File | Role |
|
| 34 |
|------|------|
|
| 35 |
-
| `
|
| 36 |
| `qwen3vl_4b_fp8_scaled.safetensors` | Krea 2 Qwen3-VL text encoder |
|
| 37 |
| `qwen_image_vae.safetensors` | Krea 2 VAE |
|
| 38 |
|
|
|
|
| 28 |
|
| 29 |
## Models
|
| 30 |
|
| 31 |
+
The text encoder and VAE are downloaded from the ungated [Comfy-Org/Krea-2 mirror](https://huggingface.co/Comfy-Org/Krea-2).
|
| 32 |
+
The Space uses the custom [PornMaster Krea 2 Turbo checkpoint](https://huggingface.co/mpasila/Krea-2-Models/resolve/main/pornmasterKrea2_v2TurboInt8.safetensors)
|
| 33 |
+
instead of the official Krea 2 Turbo diffusion checkpoint:
|
| 34 |
|
| 35 |
| File | Role |
|
| 36 |
|------|------|
|
| 37 |
+
| `pornmasterKrea2_v2TurboInt8.safetensors` | PornMaster Krea 2 Turbo diffusion model |
|
| 38 |
| `qwen3vl_4b_fp8_scaled.safetensors` | Krea 2 Qwen3-VL text encoder |
|
| 39 |
| `qwen_image_vae.safetensors` | Krea 2 VAE |
|
| 40 |
|
app.py
CHANGED
|
@@ -60,12 +60,14 @@ T2I_SOURCE = ROOT / "lustifyWorkflowsKrea2_krea2.json"
|
|
| 60 |
EDIT_SOURCE = ROOT / "lustifyWorkflowsKrea2_krea2Edit.json"
|
| 61 |
|
| 62 |
KREA_REPO = "Comfy-Org/Krea-2"
|
|
|
|
|
|
|
| 63 |
IDENTITY_REPO = "conradlocke/krea2-identity-edit"
|
| 64 |
IDENTITY_FILE = "krea2_identity_edit_v1_2.safetensors"
|
| 65 |
KREA_EDIT_NODES = "https://github.com/lbouaraba/comfyui-krea2edit.git"
|
| 66 |
|
| 67 |
DOWNLOADS = [
|
| 68 |
-
(
|
| 69 |
(KREA_REPO, "text_encoders/qwen3vl_4b_fp8_scaled.safetensors", MODELS / "text_encoders" / "qwen3vl_4b_fp8_scaled.safetensors", "Qwen3-VL text encoder"),
|
| 70 |
(KREA_REPO, "vae/qwen_image_vae.safetensors", MODELS / "vae" / "qwen_image_vae.safetensors", "Qwen image VAE"),
|
| 71 |
(IDENTITY_REPO, IDENTITY_FILE, MODELS / "loras" / "krea" / IDENTITY_FILE, "Krea 2 identity-edit adapter"),
|
|
@@ -232,7 +234,7 @@ def _t2i_workflow() -> dict[str, Any]:
|
|
| 232 |
return json.loads(json.dumps(_workflow_cache["text2image"]))
|
| 233 |
_read_source_workflow(T2I_SOURCE)
|
| 234 |
workflow = {
|
| 235 |
-
"1": {"class_type": "UNETLoader", "inputs": {"unet_name":
|
| 236 |
"2": {"class_type": "CLIPLoader", "inputs": {"clip_name": "qwen3vl_4b_fp8_scaled.safetensors", "type": "krea2", "device": "default"}},
|
| 237 |
"3": {"class_type": "VAELoader", "inputs": {"vae_name": "qwen_image_vae.safetensors"}},
|
| 238 |
"4": {"class_type": "ModelSamplingAuraFlow", "inputs": {"model": _ref("1"), "shift": 4.0}},
|
|
@@ -253,7 +255,7 @@ def _edit_workflow(has_second_reference: bool) -> dict[str, Any]:
|
|
| 253 |
"1": {"class_type": "LoadImage", "inputs": {"image": ""}},
|
| 254 |
"3": {"class_type": "CLIPLoader", "inputs": {"clip_name": "qwen3vl_4b_fp8_scaled.safetensors", "type": "krea2", "device": "default"}},
|
| 255 |
"4": {"class_type": "VAELoader", "inputs": {"vae_name": "qwen_image_vae.safetensors"}},
|
| 256 |
-
"5": {"class_type": "UNETLoader", "inputs": {"unet_name":
|
| 257 |
"6": {"class_type": "LoraLoaderModelOnly", "inputs": {"model": _ref("5"), "lora_name": "krea/" + IDENTITY_FILE, "strength_model": 1.0}},
|
| 258 |
"7": {"class_type": "VAEEncode", "inputs": {"pixels": _ref("1"), "vae": _ref("4")}},
|
| 259 |
"8": {"class_type": "EmptySD3LatentImage", "inputs": {"width": DEFAULT_WIDTH, "height": DEFAULT_HEIGHT, "batch_size": 1}},
|
|
@@ -510,7 +512,7 @@ def create_ui() -> gr.Blocks:
|
|
| 510 |
|
| 511 |
def on_mode_change(value: str):
|
| 512 |
editing = value == "edit"
|
| 513 |
-
return gr.update(visible=editing), gr.update(visible=not editing), gr.update(visible=editing), gr.update(visible=
|
| 514 |
|
| 515 |
mode.change(on_mode_change, inputs=[mode], outputs=[image_inputs, t2i_resolution, edit_controls, edit_prompt])
|
| 516 |
|
|
|
|
| 60 |
EDIT_SOURCE = ROOT / "lustifyWorkflowsKrea2_krea2Edit.json"
|
| 61 |
|
| 62 |
KREA_REPO = "Comfy-Org/Krea-2"
|
| 63 |
+
CUSTOM_KREA_REPO = "mpasila/Krea-2-Models"
|
| 64 |
+
CUSTOM_KREA_FILE = "pornmasterKrea2_v2TurboInt8.safetensors"
|
| 65 |
IDENTITY_REPO = "conradlocke/krea2-identity-edit"
|
| 66 |
IDENTITY_FILE = "krea2_identity_edit_v1_2.safetensors"
|
| 67 |
KREA_EDIT_NODES = "https://github.com/lbouaraba/comfyui-krea2edit.git"
|
| 68 |
|
| 69 |
DOWNLOADS = [
|
| 70 |
+
(CUSTOM_KREA_REPO, CUSTOM_KREA_FILE, MODELS / "diffusion_models" / CUSTOM_KREA_FILE, "PornMaster Krea 2 Turbo diffusion model"),
|
| 71 |
(KREA_REPO, "text_encoders/qwen3vl_4b_fp8_scaled.safetensors", MODELS / "text_encoders" / "qwen3vl_4b_fp8_scaled.safetensors", "Qwen3-VL text encoder"),
|
| 72 |
(KREA_REPO, "vae/qwen_image_vae.safetensors", MODELS / "vae" / "qwen_image_vae.safetensors", "Qwen image VAE"),
|
| 73 |
(IDENTITY_REPO, IDENTITY_FILE, MODELS / "loras" / "krea" / IDENTITY_FILE, "Krea 2 identity-edit adapter"),
|
|
|
|
| 234 |
return json.loads(json.dumps(_workflow_cache["text2image"]))
|
| 235 |
_read_source_workflow(T2I_SOURCE)
|
| 236 |
workflow = {
|
| 237 |
+
"1": {"class_type": "UNETLoader", "inputs": {"unet_name": CUSTOM_KREA_FILE, "weight_dtype": "default"}},
|
| 238 |
"2": {"class_type": "CLIPLoader", "inputs": {"clip_name": "qwen3vl_4b_fp8_scaled.safetensors", "type": "krea2", "device": "default"}},
|
| 239 |
"3": {"class_type": "VAELoader", "inputs": {"vae_name": "qwen_image_vae.safetensors"}},
|
| 240 |
"4": {"class_type": "ModelSamplingAuraFlow", "inputs": {"model": _ref("1"), "shift": 4.0}},
|
|
|
|
| 255 |
"1": {"class_type": "LoadImage", "inputs": {"image": ""}},
|
| 256 |
"3": {"class_type": "CLIPLoader", "inputs": {"clip_name": "qwen3vl_4b_fp8_scaled.safetensors", "type": "krea2", "device": "default"}},
|
| 257 |
"4": {"class_type": "VAELoader", "inputs": {"vae_name": "qwen_image_vae.safetensors"}},
|
| 258 |
+
"5": {"class_type": "UNETLoader", "inputs": {"unet_name": CUSTOM_KREA_FILE, "weight_dtype": "default"}},
|
| 259 |
"6": {"class_type": "LoraLoaderModelOnly", "inputs": {"model": _ref("5"), "lora_name": "krea/" + IDENTITY_FILE, "strength_model": 1.0}},
|
| 260 |
"7": {"class_type": "VAEEncode", "inputs": {"pixels": _ref("1"), "vae": _ref("4")}},
|
| 261 |
"8": {"class_type": "EmptySD3LatentImage", "inputs": {"width": DEFAULT_WIDTH, "height": DEFAULT_HEIGHT, "batch_size": 1}},
|
|
|
|
| 512 |
|
| 513 |
def on_mode_change(value: str):
|
| 514 |
editing = value == "edit"
|
| 515 |
+
return gr.update(visible=editing), gr.update(visible=not editing), gr.update(visible=editing), gr.update(visible=editing)
|
| 516 |
|
| 517 |
mode.change(on_mode_change, inputs=[mode], outputs=[image_inputs, t2i_resolution, edit_controls, edit_prompt])
|
| 518 |
|
lustifyWorkflowsKrea2_krea2Edit.json
CHANGED
|
@@ -864,8 +864,8 @@
|
|
| 864 |
"Node name for S&R": "UNETLoader",
|
| 865 |
"models": [
|
| 866 |
{
|
| 867 |
-
"name": "
|
| 868 |
-
"url": "https://huggingface.co/
|
| 869 |
"directory": "diffusion_models"
|
| 870 |
}
|
| 871 |
]
|
|
@@ -3009,4 +3009,4 @@
|
|
| 3009 |
}
|
| 3010 |
},
|
| 3011 |
"version": 0.4
|
| 3012 |
-
}
|
|
|
|
| 864 |
"Node name for S&R": "UNETLoader",
|
| 865 |
"models": [
|
| 866 |
{
|
| 867 |
+
"name": "pornmasterKrea2_v2TurboInt8.safetensors",
|
| 868 |
+
"url": "https://huggingface.co/mpasila/Krea-2-Models/resolve/main/pornmasterKrea2_v2TurboInt8.safetensors",
|
| 869 |
"directory": "diffusion_models"
|
| 870 |
}
|
| 871 |
]
|
|
|
|
| 3009 |
}
|
| 3010 |
},
|
| 3011 |
"version": 0.4
|
| 3012 |
+
}
|
test_app.py
CHANGED
|
@@ -26,7 +26,9 @@ class WorkflowTests(unittest.TestCase):
|
|
| 26 |
scheduler="beta",
|
| 27 |
seed=42,
|
| 28 |
)
|
| 29 |
-
self.assertEqual(workflow["1"]["inputs"]["unet_name"],
|
|
|
|
|
|
|
| 30 |
self.assertEqual(workflow["2"]["inputs"]["clip_name"], "qwen3vl_4b_fp8_scaled.safetensors")
|
| 31 |
self.assertEqual(workflow["5"]["inputs"]["text"], "a blue glass sculpture")
|
| 32 |
self.assertEqual(workflow["7"]["inputs"]["height"], 768)
|
|
|
|
| 26 |
scheduler="beta",
|
| 27 |
seed=42,
|
| 28 |
)
|
| 29 |
+
self.assertEqual(workflow["1"]["inputs"]["unet_name"], app.CUSTOM_KREA_FILE)
|
| 30 |
+
self.assertEqual(app.DOWNLOADS[0][0], "mpasila/Krea-2-Models")
|
| 31 |
+
self.assertEqual(app.DOWNLOADS[0][1], app.CUSTOM_KREA_FILE)
|
| 32 |
self.assertEqual(workflow["2"]["inputs"]["clip_name"], "qwen3vl_4b_fp8_scaled.safetensors")
|
| 33 |
self.assertEqual(workflow["5"]["inputs"]["text"], "a blue glass sculpture")
|
| 34 |
self.assertEqual(workflow["7"]["inputs"]["height"], 768)
|