Spaces:
Running on Zero
Running on Zero
| """Pinned model and optional adapter provenance for the public backend.""" | |
| from __future__ import annotations | |
| from dataclasses import dataclass | |
| UPSTREAM_SPACE_ID = "prithivMLmods/Qwen-Image-Edit-2511-LoRAs-Fast" | |
| UPSTREAM_SPACE_REVISION = "e1c9d2e8421d7934841d67f809d87ac7a6cdf720" | |
| BASE_MODEL_ID = "Qwen/Qwen-Image-Edit-2511" | |
| BASE_MODEL_REVISION = "6f3ccc0b56e431dc6a0c2b2039706d7d26f22cb9" | |
| TRANSFORMER_MODEL_ID = "prithivMLmods/Qwen-Image-Edit-Rapid-AIO-V19" | |
| TRANSFORMER_MODEL_REVISION = "7409bee9ad51ca89da13f80b75eded2f8afe0152" | |
| KERNEL_MODEL_ID = "kernels-community/vllm-flash-attn3" | |
| KERNEL_MODEL_REVISION = "9a3cd57fdb1a2c01ef72f1ef48ceca4991134ce6" | |
| class AdapterSpec: | |
| repo: str | |
| revision: str | |
| weights: str | |
| adapter_name: str | |
| license_status: str | |
| # These are the provenance-pinned adapters copied from the approved upstream | |
| # revision. Runtime code may only load entries from this immutable allowlist. | |
| CANDIDATE_ADAPTER_SPECS: dict[str, AdapterSpec] = { | |
| "Multiple-Angles": AdapterSpec( | |
| repo="dx8152/Qwen-Edit-2509-Multiple-angles", | |
| revision="c342b0e746c3a3275af1a4a0c6ae78e0e4802531", | |
| weights="镜头转换.safetensors", | |
| adapter_name="multiple-angles", | |
| license_status="metadata-apache-2.0", | |
| ), | |
| "Photo-to-Anime": AdapterSpec( | |
| repo="autoweeb/Qwen-Image-Edit-2509-Photo-to-Anime", | |
| revision="2fdebf4e0c1ea04ef3037ff531bc5a4a3a842396", | |
| weights="Qwen-Image-Edit-2509-Photo-to-Anime_000001000.safetensors", | |
| adapter_name="photo-to-anime", | |
| license_status="metadata-mit", | |
| ), | |
| "Anime-V2": AdapterSpec( | |
| repo="prithivMLmods/Qwen-Image-Edit-2511-Anime", | |
| revision="977f8c2ed22c8581c8750370bfce34058b253598", | |
| weights="Qwen-Image-Edit-2511-Anime-2000.safetensors", | |
| adapter_name="anime-v2", | |
| license_status="metadata-apache-2.0", | |
| ), | |
| "Light-Migration": AdapterSpec( | |
| repo="dx8152/Qwen-Edit-2509-Light-Migration", | |
| revision="402a49e4afaf739e7dc21da3549ae9353db9759b", | |
| weights="参考色调.safetensors", | |
| adapter_name="light-migration", | |
| license_status="metadata-apache-2.0", | |
| ), | |
| "Upscaler": AdapterSpec( | |
| repo="starsfriday/Qwen-Image-Edit-2511-Upscale2K", | |
| revision="129c6cc77643fd55e59902f2e9363912b638ad26", | |
| weights="qwen_image_edit_2511_upscale.safetensors", | |
| adapter_name="upscale-2k", | |
| license_status="metadata-apache-2.0", | |
| ), | |
| "Style-Transfer": AdapterSpec( | |
| repo="zooeyy/Style-Transfer", | |
| revision="88b73376f56b5fbec98e796b84b42627490f3172", | |
| weights="Style Transfer-Alpha-V0.1.safetensors", | |
| adapter_name="style-transfer", | |
| license_status="conflict-metadata-apache-card-mit", | |
| ), | |
| "Manga-Tone": AdapterSpec( | |
| repo="nappa114514/Qwen-Image-Edit-2509-Manga-Tone", | |
| revision="a415e6bf60a65814b2cfafd9d07bbe4e918c044d", | |
| weights="tone001.safetensors", | |
| adapter_name="manga-tone", | |
| license_status="metadata-apache-2.0", | |
| ), | |
| "Anything2Real": AdapterSpec( | |
| repo="lrzjason/Anything2Real_2601", | |
| revision="b547e090d255ac10b190204c7868b03a61faf15e", | |
| weights="anything2real_2601.safetensors", | |
| adapter_name="anything2real", | |
| license_status="metadata-apache-2.0", | |
| ), | |
| "Fal-Multiple-Angles": AdapterSpec( | |
| repo="fal/Qwen-Image-Edit-2511-Multiple-Angles-LoRA", | |
| revision="e3066224ab74263f4a5b6179cd1a3b0a15577e44", | |
| weights="qwen-image-edit-2511-multiple-angles-lora.safetensors", | |
| adapter_name="fal-multiple-angles", | |
| license_status="metadata-apache-2.0", | |
| ), | |
| "Polaroid-Photo": AdapterSpec( | |
| repo="prithivMLmods/Qwen-Image-Edit-2511-Polaroid-Photo", | |
| revision="6e9d2f4b9fc0b9a1484cccade8ffdcfed13bd2a1", | |
| weights="Qwen-Image-Edit-2511-Polaroid-Photo.safetensors", | |
| adapter_name="polaroid-photo", | |
| license_status="metadata-apache-2.0-brand-review", | |
| ), | |
| "Unblur-Anything": AdapterSpec( | |
| repo="prithivMLmods/Qwen-Image-Edit-2511-Unblur-Upscale", | |
| revision="365faf9244e381bf5ac1a6d124eb2a1d1ed857ff", | |
| weights="Qwen-Image-Edit-Unblur-Upscale_15.safetensors", | |
| adapter_name="unblur-anything", | |
| license_status="metadata-apache-2.0", | |
| ), | |
| "Midnight-Noir-Eyes-Spotlight": AdapterSpec( | |
| repo="prithivMLmods/Qwen-Image-Edit-2511-Midnight-Noir-Eyes-Spotlight", | |
| revision="c1bfc0f3c9e753fb4eb29be5f9de9440fc6ff055", | |
| weights="Qwen-Image-Edit-2511-Midnight-Noir-Eyes-Spotlight.safetensors", | |
| adapter_name="midnight-noir-eyes-spotlight", | |
| license_status="metadata-apache-2.0", | |
| ), | |
| "Hyper-Realistic-Portrait": AdapterSpec( | |
| repo="prithivMLmods/Qwen-Image-Edit-2511-Hyper-Realistic-Portrait", | |
| revision="bdac42896d98c846751e8f8df018154318790fee", | |
| weights="HRP_20.safetensors", | |
| adapter_name="hyper-realistic-portrait", | |
| license_status="metadata-apache-2.0", | |
| ), | |
| "Ultra-Realistic-Portrait": AdapterSpec( | |
| repo="prithivMLmods/Qwen-Image-Edit-2511-Ultra-Realistic-Portrait", | |
| revision="78ae4115a70bd234799747675f096be3c58f0c87", | |
| weights="URP_20.safetensors", | |
| adapter_name="ultra-realistic-portrait", | |
| license_status="metadata-apache-2.0", | |
| ), | |
| "Pixar-Inspired-3D": AdapterSpec( | |
| repo="prithivMLmods/Qwen-Image-Edit-2511-Pixar-Inspired-3D", | |
| revision="833e5db8031cd3a1b3e70cd0e016fc78d09a4785", | |
| weights="PI3_20.safetensors", | |
| adapter_name="pi3", | |
| license_status="metadata-apache-2.0-brand-review", | |
| ), | |
| "Noir-Comic-Book": AdapterSpec( | |
| repo="prithivMLmods/Qwen-Image-Edit-2511-Noir-Comic-Book-Panel", | |
| revision="b6774f01b2fea7074882d0dec1e1694cea30df12", | |
| weights="Noir-Comic-Book-Panel_20.safetensors", | |
| adapter_name="ncb", | |
| license_status="metadata-apache-2.0", | |
| ), | |
| "Any-light": AdapterSpec( | |
| repo="lilylilith/QIE-2511-MP-AnyLight", | |
| revision="ad3ce5f3602542cc2cfae8db9616f8712e0d025c", | |
| weights="QIE-2511-AnyLight_.safetensors", | |
| adapter_name="any-light", | |
| license_status="metadata-apache-2.0", | |
| ), | |
| "Studio-DeLight": AdapterSpec( | |
| repo="prithivMLmods/QIE-2511-Studio-DeLight", | |
| revision="a5c2440989ba6a025ac99acac095369486e32774", | |
| weights="QIE-2511-Studio-DeLight-5000.safetensors", | |
| adapter_name="studio-delight", | |
| license_status="metadata-apache-2.0", | |
| ), | |
| "Cinematic-FlatLog": AdapterSpec( | |
| repo="prithivMLmods/QIE-2511-Cinematic-FlatLog-Control", | |
| revision="f30505226920906802c9677634219bc53edfd915", | |
| weights="QIE-2511-Cinematic-FlatLog-Control-3200.safetensors", | |
| adapter_name="flat-log", | |
| license_status="metadata-apache-2.0", | |
| ), | |
| } | |
| # General editing remains available without an adapter, while all 19 pinned | |
| # upstream adapters are explicitly enabled. The runtime keeps at most one LoRA | |
| # resident at a time; this allowlist does not imply that all weights are loaded. | |
| ENABLED_ADAPTER_IDS: frozenset[str] = frozenset(CANDIDATE_ADAPTER_SPECS) | |
| ENABLED_ADAPTER_SPECS = { | |
| adapter_id: CANDIDATE_ADAPTER_SPECS[adapter_id] | |
| for adapter_id in CANDIDATE_ADAPTER_SPECS | |
| if adapter_id in ENABLED_ADAPTER_IDS | |
| } | |
| def assert_pinned_provenance() -> None: | |
| revisions = [ | |
| UPSTREAM_SPACE_REVISION, | |
| BASE_MODEL_REVISION, | |
| TRANSFORMER_MODEL_REVISION, | |
| KERNEL_MODEL_REVISION, | |
| *(spec.revision for spec in CANDIDATE_ADAPTER_SPECS.values()), | |
| ] | |
| if any(len(revision) != 40 or any(c not in "0123456789abcdef" for c in revision) for revision in revisions): | |
| raise RuntimeError("All remote assets must use a full 40-character commit revision") | |
| assert_pinned_provenance() | |