local-gpu-imagegen 0.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- build_showcase.py +48 -0
- check_gpu.py +124 -0
- export_acceptance_evidence.py +808 -0
- export_real_demo.py +783 -0
- generate_image.py +302 -0
- local_gpu_imagegen/__init__.py +3 -0
- local_gpu_imagegen/artifacts.py +326 -0
- local_gpu_imagegen/backend_contract.py +176 -0
- local_gpu_imagegen/backends/__init__.py +9 -0
- local_gpu_imagegen/backends/base.py +411 -0
- local_gpu_imagegen/backends/comfyui.py +1308 -0
- local_gpu_imagegen/backends/webui.py +425 -0
- local_gpu_imagegen/cli.py +102 -0
- local_gpu_imagegen/client_setup.py +136 -0
- local_gpu_imagegen/discovery.py +815 -0
- local_gpu_imagegen/engine.py +1774 -0
- local_gpu_imagegen/errors.py +32 -0
- local_gpu_imagegen/file_verification.py +196 -0
- local_gpu_imagegen/generation_plan.py +418 -0
- local_gpu_imagegen/masks.py +527 -0
- local_gpu_imagegen/model_catalog.py +763 -0
- local_gpu_imagegen/model_identity.py +376 -0
- local_gpu_imagegen/model_router.py +486 -0
- local_gpu_imagegen/paths.py +77 -0
- local_gpu_imagegen/png_pixels.py +412 -0
- local_gpu_imagegen/postprocess.py +313 -0
- local_gpu_imagegen/preview.py +117 -0
- local_gpu_imagegen/profile_registry.py +244 -0
- local_gpu_imagegen/prompt_compilers.py +58 -0
- local_gpu_imagegen/regional_layout.py +153 -0
- local_gpu_imagegen/revisions.py +264 -0
- local_gpu_imagegen/run_store.py +2177 -0
- local_gpu_imagegen/services.py +101 -0
- local_gpu_imagegen/trust_registry.py +734 -0
- local_gpu_imagegen/two_stage_layout.py +213 -0
- local_gpu_imagegen/visual_review.py +294 -0
- local_gpu_imagegen/workflow_onboarding.py +550 -0
- local_gpu_imagegen/workflow_templates.py +1566 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/.mcp.json +11 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/evidence/schemas/authority.schema.json +54 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/evidence/schemas/client-session.schema.json +165 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/evidence/schemas/real-demo.schema.json +196 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/evidence/schemas/run-evidence.schema.json +180 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/evidence/schemas/star-campaign.schema.json +95 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/evidence/schemas/star-event.schema.json +235 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/profiles/base.json +13 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/profiles/models/anything-v5.json +56 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/profiles/models/sd-turbo.json +38 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/profiles/models/sdxl-base-1.0.json +72 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/profiles/schemas/model.schema.json +101 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/profiles/schemas/profile.schema.json +16 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/profiles/schemas/style.schema.json +23 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/profiles/styles/anime.json +18 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/profiles/use-cases/presentation-visual.json +43 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/profiles/use-cases/standalone-illustration.json +26 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/profiles/use-cases/ui-visual-asset.json +48 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/skills/local-gpu-imagegen/SKILL.md +287 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/workflows/comfyui/anima-txt2img-v1.json +106 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/workflows/comfyui/sd15-txt2img-v1.json +157 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/workflows/comfyui/sdxl-regional-txt2img-v1.json +295 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/workflows/comfyui/sdxl-two-stage-copy-subject-v1.json +174 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/workflows/comfyui/sdxl-txt2img-v1.json +156 -0
- local_gpu_imagegen-0.8.0.data/data/share/local-gpu-imagegen/workflows/comfyui/z-image-turbo-txt2img-v1.json +121 -0
- local_gpu_imagegen-0.8.0.dist-info/METADATA +458 -0
- local_gpu_imagegen-0.8.0.dist-info/RECORD +75 -0
- local_gpu_imagegen-0.8.0.dist-info/WHEEL +5 -0
- local_gpu_imagegen-0.8.0.dist-info/entry_points.txt +2 -0
- local_gpu_imagegen-0.8.0.dist-info/licenses/LICENSE +21 -0
- local_gpu_imagegen-0.8.0.dist-info/top_level.txt +12 -0
- mcp_server.py +2065 -0
- validate_acceptance_evidence.py +1223 -0
- validate_client_sessions.py +516 -0
- validate_real_demo.py +814 -0
- verify_client_configs.py +91 -0
- verify_mcp.py +139 -0
build_showcase.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import argparse
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def build_showcase(before: Path, after: Path, output: Path) -> None:
|
|
9
|
+
try:
|
|
10
|
+
from PIL import Image, ImageOps
|
|
11
|
+
except ImportError as exc:
|
|
12
|
+
raise RuntimeError("showcase_requires_existing_local_pillow") from exc
|
|
13
|
+
|
|
14
|
+
frames = []
|
|
15
|
+
with Image.open(before) as first, Image.open(after) as second:
|
|
16
|
+
for source in (first, second):
|
|
17
|
+
converted = source.convert("RGB")
|
|
18
|
+
try:
|
|
19
|
+
frames.append(ImageOps.fit(converted, (960, 540)))
|
|
20
|
+
finally:
|
|
21
|
+
converted.close()
|
|
22
|
+
try:
|
|
23
|
+
frames[0].save(
|
|
24
|
+
output,
|
|
25
|
+
format="GIF",
|
|
26
|
+
save_all=True,
|
|
27
|
+
append_images=frames[1:],
|
|
28
|
+
duration=(1400, 1400),
|
|
29
|
+
loop=0,
|
|
30
|
+
optimize=True,
|
|
31
|
+
)
|
|
32
|
+
finally:
|
|
33
|
+
for frame in frames:
|
|
34
|
+
frame.close()
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def main() -> int:
|
|
38
|
+
parser = argparse.ArgumentParser(description="Encode a genuine before/after showcase GIF.")
|
|
39
|
+
parser.add_argument("before", type=Path)
|
|
40
|
+
parser.add_argument("after", type=Path)
|
|
41
|
+
parser.add_argument("output", type=Path)
|
|
42
|
+
args = parser.parse_args()
|
|
43
|
+
build_showcase(args.before, args.after, args.output)
|
|
44
|
+
return 0
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
if __name__ == "__main__":
|
|
48
|
+
raise SystemExit(main())
|
check_gpu.py
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import importlib.util
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import sys
|
|
8
|
+
import urllib.error
|
|
9
|
+
import urllib.request
|
|
10
|
+
|
|
11
|
+
from local_gpu_imagegen.backends.comfyui import ComfyUIAdapter
|
|
12
|
+
from local_gpu_imagegen.errors import AssetEngineError
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def module_available(name: str) -> bool:
|
|
16
|
+
return importlib.util.find_spec(name) is not None
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def check_webui() -> dict[str, object]:
|
|
20
|
+
base_url = os.environ.get("LOCAL_GPU_IMAGEGEN_WEBUI_URL", "http://127.0.0.1:7860").rstrip("/")
|
|
21
|
+
report: dict[str, object] = {
|
|
22
|
+
"url": base_url,
|
|
23
|
+
"available": False,
|
|
24
|
+
"model": None,
|
|
25
|
+
"api_error": None,
|
|
26
|
+
}
|
|
27
|
+
try:
|
|
28
|
+
with urllib.request.urlopen(base_url + "/sdapi/v1/options", timeout=5) as response:
|
|
29
|
+
options = json.loads(response.read().decode("utf-8"))
|
|
30
|
+
report["available"] = True
|
|
31
|
+
report["model"] = options.get("sd_model_checkpoint")
|
|
32
|
+
except (OSError, urllib.error.URLError, TimeoutError, json.JSONDecodeError) as exc:
|
|
33
|
+
report["api_error"] = str(exc)
|
|
34
|
+
return report
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def check_comfyui() -> dict[str, object]:
|
|
38
|
+
base_url = os.environ.get(
|
|
39
|
+
"LOCAL_GPU_IMAGEGEN_COMFYUI_URL",
|
|
40
|
+
"http://127.0.0.1:8188",
|
|
41
|
+
)
|
|
42
|
+
try:
|
|
43
|
+
adapter = ComfyUIAdapter(base_url, timeout=5)
|
|
44
|
+
return {
|
|
45
|
+
**adapter.probe(),
|
|
46
|
+
"url": adapter.base_url,
|
|
47
|
+
"available": True,
|
|
48
|
+
"api_error": None,
|
|
49
|
+
}
|
|
50
|
+
except AssetEngineError as error:
|
|
51
|
+
return {
|
|
52
|
+
"url": base_url,
|
|
53
|
+
"available": False,
|
|
54
|
+
"api_error": error.code,
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def collect_report() -> dict[str, object]:
|
|
59
|
+
report: dict[str, object] = {
|
|
60
|
+
"python": {
|
|
61
|
+
"executable": sys.executable,
|
|
62
|
+
"version": sys.version.split()[0],
|
|
63
|
+
},
|
|
64
|
+
"python_packages": {
|
|
65
|
+
"torch": module_available("torch"),
|
|
66
|
+
"diffusers": module_available("diffusers"),
|
|
67
|
+
"transformers": module_available("transformers"),
|
|
68
|
+
"PIL": module_available("PIL"),
|
|
69
|
+
},
|
|
70
|
+
"cuda": {
|
|
71
|
+
"available": False,
|
|
72
|
+
"device_count": 0,
|
|
73
|
+
"devices": [],
|
|
74
|
+
},
|
|
75
|
+
"webui": check_webui(),
|
|
76
|
+
"comfyui": check_comfyui(),
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (
|
|
80
|
+
report["python_packages"]["torch"]
|
|
81
|
+
and not report["webui"]["available"]
|
|
82
|
+
and not report["comfyui"]["available"]
|
|
83
|
+
):
|
|
84
|
+
import torch
|
|
85
|
+
|
|
86
|
+
cuda_available = bool(torch.cuda.is_available())
|
|
87
|
+
device_count = int(torch.cuda.device_count()) if cuda_available else 0
|
|
88
|
+
devices = []
|
|
89
|
+
for index in range(device_count):
|
|
90
|
+
props = torch.cuda.get_device_properties(index)
|
|
91
|
+
devices.append(
|
|
92
|
+
{
|
|
93
|
+
"index": index,
|
|
94
|
+
"name": props.name,
|
|
95
|
+
"total_memory_gb": round(props.total_memory / (1024**3), 2),
|
|
96
|
+
"capability": f"{props.major}.{props.minor}",
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
report["cuda"] = {
|
|
100
|
+
"available": cuda_available,
|
|
101
|
+
"device_count": device_count,
|
|
102
|
+
"devices": devices,
|
|
103
|
+
"torch_version": torch.__version__,
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
diffusers_ready = all(report["python_packages"].values()) and bool(report["cuda"]["available"])
|
|
107
|
+
webui_ready = bool(report["webui"]["available"])
|
|
108
|
+
comfyui_ready = bool(report["comfyui"]["available"])
|
|
109
|
+
ready = diffusers_ready or webui_ready or comfyui_ready
|
|
110
|
+
report["diffusers_ready"] = diffusers_ready
|
|
111
|
+
report["webui_ready"] = webui_ready
|
|
112
|
+
report["comfyui_ready"] = comfyui_ready
|
|
113
|
+
report["ready"] = ready
|
|
114
|
+
return report
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def main() -> int:
|
|
118
|
+
report = collect_report()
|
|
119
|
+
print(json.dumps(report, indent=2))
|
|
120
|
+
return 0 if report["ready"] else 1
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
if __name__ == "__main__":
|
|
124
|
+
raise SystemExit(main())
|