Spaces:
Paused
Paused
app.pyに初期化処理を追加し、必要なリポジトリ(Wan2.1およびVACE)をクローンする機能を実装しました。また、README.mdでapp_fileをapp.pyに変更し、startup.shを削除しました。
Browse files- README.md +1 -1
- app.py +29 -0
- startup.sh +0 -13
README.md
CHANGED
|
@@ -5,7 +5,7 @@ colorFrom: purple
|
|
| 5 |
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.34.2
|
| 8 |
-
app_file:
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
|
|
|
| 5 |
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.34.2
|
| 8 |
+
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
app.py
CHANGED
|
@@ -1,6 +1,35 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from fastapi import FastAPI, UploadFile, File
|
| 3 |
import uvicorn, uuid, os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
from wan_runner import generate_video, generate_image
|
| 5 |
|
| 6 |
api = FastAPI()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from fastapi import FastAPI, UploadFile, File
|
| 3 |
import uvicorn, uuid, os
|
| 4 |
+
import subprocess
|
| 5 |
+
import sys
|
| 6 |
+
|
| 7 |
+
# Initialize on startup
|
| 8 |
+
def initialize():
|
| 9 |
+
"""Initialize the application by downloading models and cloning repositories"""
|
| 10 |
+
print("Initializing Wan2.1 VACE environment...")
|
| 11 |
+
|
| 12 |
+
# Clone repositories if they don't exist
|
| 13 |
+
if not os.path.exists("Wan2.1"):
|
| 14 |
+
print("Cloning Wan2.1 repository...")
|
| 15 |
+
try:
|
| 16 |
+
subprocess.run(["git", "clone", "https://github.com/Wan-Video/Wan2.1.git"], check=True)
|
| 17 |
+
except Exception as e:
|
| 18 |
+
print(f"Warning: Failed to clone Wan2.1: {e}")
|
| 19 |
+
|
| 20 |
+
if not os.path.exists("VACE"):
|
| 21 |
+
print("Cloning VACE repository...")
|
| 22 |
+
try:
|
| 23 |
+
subprocess.run(["git", "clone", "https://github.com/ali-vilab/VACE.git"], check=True)
|
| 24 |
+
except Exception as e:
|
| 25 |
+
print(f"Warning: Failed to clone VACE: {e}")
|
| 26 |
+
|
| 27 |
+
# Note: Model downloads will happen automatically via huggingface-hub when needed
|
| 28 |
+
|
| 29 |
+
# Run initialization
|
| 30 |
+
initialize()
|
| 31 |
+
|
| 32 |
+
# Import after initialization
|
| 33 |
from wan_runner import generate_video, generate_image
|
| 34 |
|
| 35 |
api = FastAPI()
|
startup.sh
DELETED
|
@@ -1,13 +0,0 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
-
# Startup script for Hugging Face Spaces
|
| 3 |
-
|
| 4 |
-
echo "Starting Wan2.1 VACE setup..."
|
| 5 |
-
|
| 6 |
-
# Run model download script
|
| 7 |
-
if [ -f "download_models.sh" ]; then
|
| 8 |
-
chmod +x download_models.sh
|
| 9 |
-
./download_models.sh
|
| 10 |
-
fi
|
| 11 |
-
|
| 12 |
-
# Start the application
|
| 13 |
-
python app.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|