Spaces:
Configuration error
Configuration error
Update app.py
Browse files
app.py
CHANGED
|
@@ -30,12 +30,25 @@ import gradio as gr
|
|
| 30 |
import torch
|
| 31 |
from worldgen import WorldGen
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
def get_worldgen():
|
| 36 |
global _wg
|
| 37 |
if _wg is None:
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
return _wg
|
| 40 |
|
| 41 |
def _zip_directory(dir_path: Path) -> str:
|
|
|
|
| 30 |
import torch
|
| 31 |
from worldgen import WorldGen
|
| 32 |
|
| 33 |
+
from huggingface_hub import hf_hub_download
|
| 34 |
+
|
| 35 |
def get_worldgen():
|
| 36 |
global _wg
|
| 37 |
if _wg is None:
|
| 38 |
+
# 確保使用公開模型且不帶 token
|
| 39 |
+
model_path = hf_hub_download(
|
| 40 |
+
repo_id="nunchaku-tech/nunchaku-flux.1-dev",
|
| 41 |
+
filename="unquantized_layers.safetensors",
|
| 42 |
+
token=None # 強制匿名模式
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
# 初始化 WorldGen,並指定模型路徑(如果需要)
|
| 46 |
+
_wg = WorldGen(
|
| 47 |
+
mode="t2s",
|
| 48 |
+
device="cpu",
|
| 49 |
+
low_vram=True,
|
| 50 |
+
lora_path=None # 如果你有 LoRA 模型可以指定路徑
|
| 51 |
+
)
|
| 52 |
return _wg
|
| 53 |
|
| 54 |
def _zip_directory(dir_path: Path) -> str:
|