Spaces:
Running
Running
| # app.py (updated to commit cfe7995993fd938b55a636e62824f08993bb9d53) | |
| import os | |
| import sys | |
| import time | |
| import gradio as gr | |
| import requests | |
| import dashscope | |
| from dashscope.utils.oss_utils import check_and_upload_local | |
| # === 環境変数とAPIキーの設定 === | |
| DASHSCOPE_API_KEY = os.getenv("DASHSCOPE_API_KEY") | |
| if not DASHSCOPE_API_KEY: | |
| print("⚠️ Warning: DASHSCOPE_API_KEY is not set. Please set it in your Hugging Face Space settings.") | |
| else: | |
| dashscope.api_key = DASHSCOPE_API_KEY | |
| class WanAnimateApp: | |
| def __init__(self, url, get_url): | |
| self.url = url | |
| self.get_url = get_url | |
| def predict(self, ref_img, video, model_id, model): | |
| if not DASHSCOPE_API_KEY: | |
| return None, "❌ Error: DASHSCOPE_API_KEY not found. Please set your key in environment variables." | |
| # === Upload files to OSS === | |
| _, image_url = check_and_upload | |