Spaces:
Running on Zero
Running on Zero
bann commited on
Commit ·
8049492
1
Parent(s): 97a97db
fix(gradio): align gradio with sdk 6.20.0 and restore standard action handlers
Browse files- README.md +1 -9
- app.py +6 -39
- requirements.txt +1 -2
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 🎬
|
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
|
@@ -15,11 +15,3 @@ suggested_hardware: zero-a10g
|
|
| 15 |
# Wan 2.2 Video Studio (ZeroGPU + Multi-LoRA + Base NSFW)
|
| 16 |
|
| 17 |
A high-performance AI video generation studio running **Wan 2.2 (MoE)** on **ZeroGPU**.
|
| 18 |
-
|
| 19 |
-
### Features:
|
| 20 |
-
- 🚀 **Wan 2.2 MoE Architecture**: Native Diffusers integration (`Wan2.2-I2V-A14B`, `Wan2.2-TI2V-5B`, `Wan2.2-T2V-A14B`).
|
| 21 |
-
- 🔞 **Base NSFW Adapter System**: Pre-loaded with `WAN General NSFW Model (Civitai 1307155)` to unlock full anatomical generation.
|
| 22 |
-
- ⚡ **ZeroGPU Acceleration**: Runs with dynamic GPU scheduling on A10G / H100 hardware.
|
| 23 |
-
- 🧩 **Multi-LoRA Engine**: Load custom action and style LoRAs from Civitai, Hugging Face, or local files with Trigger Words.
|
| 24 |
-
- 📐 **300-Hours Civitai Optimization**: Strict multiple-of-16 aspect ratios (832x480, 480x832, 1280x720, etc.) for clean motion.
|
| 25 |
-
- 📖 **Built-in Prompt & Anatomical Motion Guide**: Designed with the official structured prompt standards.
|
|
|
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 6.20.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
|
|
|
| 15 |
# Wan 2.2 Video Studio (ZeroGPU + Multi-LoRA + Base NSFW)
|
| 16 |
|
| 17 |
A high-performance AI video generation studio running **Wan 2.2 (MoE)** on **ZeroGPU**.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
CHANGED
|
@@ -2,41 +2,11 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
import os
|
| 6 |
-
os.environ["GRADIO_SSR"] = "False"
|
| 7 |
-
|
| 8 |
-
# Safe monkey-patch for Gradio 5.x schema inspection bug
|
| 9 |
-
try:
|
| 10 |
-
import gradio_client.utils as client_utils
|
| 11 |
-
_orig_get_type = getattr(client_utils, "get_type", None)
|
| 12 |
-
if _orig_get_type is not None:
|
| 13 |
-
def _safe_get_type(schema):
|
| 14 |
-
if isinstance(schema, bool):
|
| 15 |
-
return "boolean"
|
| 16 |
-
if not isinstance(schema, dict):
|
| 17 |
-
return "any"
|
| 18 |
-
return _orig_get_type(schema)
|
| 19 |
-
client_utils.get_type = _safe_get_type
|
| 20 |
-
|
| 21 |
-
_orig_json_schema = getattr(client_utils, "_json_schema_to_python_type", None)
|
| 22 |
-
if _orig_json_schema is not None:
|
| 23 |
-
def _safe_json_schema_to_python_type(schema, defs=None):
|
| 24 |
-
if isinstance(schema, bool):
|
| 25 |
-
return "bool"
|
| 26 |
-
if not isinstance(schema, dict):
|
| 27 |
-
return "Any"
|
| 28 |
-
try:
|
| 29 |
-
return _orig_json_schema(schema, defs)
|
| 30 |
-
except Exception:
|
| 31 |
-
return "Any"
|
| 32 |
-
client_utils._json_schema_to_python_type = _safe_json_schema_to_python_type
|
| 33 |
-
except Exception:
|
| 34 |
-
pass
|
| 35 |
-
|
| 36 |
import hashlib
|
| 37 |
import ipaddress
|
| 38 |
import json
|
| 39 |
import mimetypes
|
|
|
|
| 40 |
import random
|
| 41 |
import re
|
| 42 |
import shutil
|
|
@@ -961,7 +931,6 @@ with gr.Blocks(css=custom_css, title="Wan 2.2 Video Studio") as app:
|
|
| 961 |
fn=on_lora1_change,
|
| 962 |
inputs=[lora1_preset],
|
| 963 |
outputs=[lora1_custom_url_grp, lora1_hf_grp, lora1_local_grp, lora1_trigger_display, lora1_strength],
|
| 964 |
-
api_name=False,
|
| 965 |
)
|
| 966 |
|
| 967 |
def on_lora2_change(preset_val):
|
|
@@ -980,7 +949,6 @@ with gr.Blocks(css=custom_css, title="Wan 2.2 Video Studio") as app:
|
|
| 980 |
fn=on_lora2_change,
|
| 981 |
inputs=[lora2_preset],
|
| 982 |
outputs=[lora2_custom_url_grp, lora2_hf_grp, lora2_local_grp, lora2_trigger_display, lora2_strength],
|
| 983 |
-
api_name=False,
|
| 984 |
)
|
| 985 |
|
| 986 |
def append_triggers(curr_prompt, triggers):
|
|
@@ -1012,10 +980,10 @@ with gr.Blocks(css=custom_css, title="Wan 2.2 Video Studio") as app:
|
|
| 1012 |
"The setting is a bed with dark grey sheets under warm, low indoor lighting."
|
| 1013 |
)
|
| 1014 |
|
| 1015 |
-
hmnsfw_example_btn.click(fn=load_hmnsfw_example, outputs=[prompt]
|
| 1016 |
-
nsfw_base_trigger_btn.click(fn=lambda p: append_triggers(p, "nsfwsks, uncensored, explicit"), inputs=[prompt], outputs=[prompt]
|
| 1017 |
-
add_lora1_triggers_btn.click(fn=append_triggers, inputs=[prompt, lora1_trigger_display], outputs=[prompt]
|
| 1018 |
-
add_lora2_triggers_btn.click(fn=append_triggers, inputs=[prompt, lora2_trigger_display], outputs=[prompt]
|
| 1019 |
|
| 1020 |
generate_btn.click(
|
| 1021 |
fn=generate_video,
|
|
@@ -1048,7 +1016,6 @@ with gr.Blocks(css=custom_css, title="Wan 2.2 Video Studio") as app:
|
|
| 1048 |
civitai_api_key,
|
| 1049 |
],
|
| 1050 |
outputs=[output_video, output_report, seed],
|
| 1051 |
-
api_name=False,
|
| 1052 |
)
|
| 1053 |
|
| 1054 |
if __name__ == "__main__":
|
|
@@ -1057,4 +1024,4 @@ if __name__ == "__main__":
|
|
| 1057 |
get_or_load_pipeline(DEFAULT_MODEL_REPO)
|
| 1058 |
except Exception as err:
|
| 1059 |
print(f"[wan] initial preload deferred to first call: {err}", flush=True)
|
| 1060 |
-
app.launch(allowed_paths=[OUTPUT_DIR])
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
import hashlib
|
| 6 |
import ipaddress
|
| 7 |
import json
|
| 8 |
import mimetypes
|
| 9 |
+
import os
|
| 10 |
import random
|
| 11 |
import re
|
| 12 |
import shutil
|
|
|
|
| 931 |
fn=on_lora1_change,
|
| 932 |
inputs=[lora1_preset],
|
| 933 |
outputs=[lora1_custom_url_grp, lora1_hf_grp, lora1_local_grp, lora1_trigger_display, lora1_strength],
|
|
|
|
| 934 |
)
|
| 935 |
|
| 936 |
def on_lora2_change(preset_val):
|
|
|
|
| 949 |
fn=on_lora2_change,
|
| 950 |
inputs=[lora2_preset],
|
| 951 |
outputs=[lora2_custom_url_grp, lora2_hf_grp, lora2_local_grp, lora2_trigger_display, lora2_strength],
|
|
|
|
| 952 |
)
|
| 953 |
|
| 954 |
def append_triggers(curr_prompt, triggers):
|
|
|
|
| 980 |
"The setting is a bed with dark grey sheets under warm, low indoor lighting."
|
| 981 |
)
|
| 982 |
|
| 983 |
+
hmnsfw_example_btn.click(fn=load_hmnsfw_example, outputs=[prompt])
|
| 984 |
+
nsfw_base_trigger_btn.click(fn=lambda p: append_triggers(p, "nsfwsks, uncensored, explicit"), inputs=[prompt], outputs=[prompt])
|
| 985 |
+
add_lora1_triggers_btn.click(fn=append_triggers, inputs=[prompt, lora1_trigger_display], outputs=[prompt])
|
| 986 |
+
add_lora2_triggers_btn.click(fn=append_triggers, inputs=[prompt, lora2_trigger_display], outputs=[prompt])
|
| 987 |
|
| 988 |
generate_btn.click(
|
| 989 |
fn=generate_video,
|
|
|
|
| 1016 |
civitai_api_key,
|
| 1017 |
],
|
| 1018 |
outputs=[output_video, output_report, seed],
|
|
|
|
| 1019 |
)
|
| 1020 |
|
| 1021 |
if __name__ == "__main__":
|
|
|
|
| 1024 |
get_or_load_pipeline(DEFAULT_MODEL_REPO)
|
| 1025 |
except Exception as err:
|
| 1026 |
print(f"[wan] initial preload deferred to first call: {err}", flush=True)
|
| 1027 |
+
app.launch(show_error=True, allowed_paths=[OUTPUT_DIR])
|
requirements.txt
CHANGED
|
@@ -3,8 +3,7 @@ transformers>=4.49.0
|
|
| 3 |
accelerate>=1.2.0
|
| 4 |
sentencepiece
|
| 5 |
safetensors
|
| 6 |
-
gradio
|
| 7 |
-
gradio_client>=1.6.0
|
| 8 |
spaces>=0.51.1
|
| 9 |
imageio[ffmpeg]
|
| 10 |
torchvision
|
|
|
|
| 3 |
accelerate>=1.2.0
|
| 4 |
sentencepiece
|
| 5 |
safetensors
|
| 6 |
+
gradio[mcp]==6.20.0
|
|
|
|
| 7 |
spaces>=0.51.1
|
| 8 |
imageio[ffmpeg]
|
| 9 |
torchvision
|