Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,15 +13,9 @@ from diffsynth import ModelManager, WanVideoPipeline, save_video
|
|
| 13 |
|
| 14 |
num_frames, width, height = 49, 832, 480
|
| 15 |
gpu_id = 0
|
| 16 |
-
device = f'cuda:{gpu_id}'
|
| 17 |
-
|
| 18 |
-
from huggingface_hub import login
|
| 19 |
-
import os
|
| 20 |
-
# 使用环境变量中的 token 登录
|
| 21 |
-
token = os.environ.get("hf_sapce_token")
|
| 22 |
-
if token:
|
| 23 |
-
login(token)
|
| 24 |
|
|
|
|
| 25 |
|
| 26 |
rmbg_model = AutoModelForImageSegmentation.from_pretrained('briaai/RMBG-2.0', trust_remote_code=True)
|
| 27 |
torch.set_float32_matmul_precision(['high', 'highest'][0])
|
|
|
|
| 13 |
|
| 14 |
num_frames, width, height = 49, 832, 480
|
| 15 |
gpu_id = 0
|
| 16 |
+
device = f'cuda:{gpu_id}' if torch.cuda.is_available() else 'cpu'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
os.system("wget https://huggingface.co/alibaba-pai/Wan2.1-Fun-1.3B-Control/resolve/main/Wan2.1_VAE.pth")
|
| 19 |
|
| 20 |
rmbg_model = AutoModelForImageSegmentation.from_pretrained('briaai/RMBG-2.0', trust_remote_code=True)
|
| 21 |
torch.set_float32_matmul_precision(['high', 'highest'][0])
|