Spaces:
Running
Running
Upload 2 files
Browse files- DEPLOYMENT.md +153 -0
- app.py +144 -178
DEPLOYMENT.md
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# MoneyPrinterTurbo Huggingface Spaces 部署指南
|
2 |
+
|
3 |
+
## 🎉 最新部署状态
|
4 |
+
|
5 |
+
✅ **部署成功!** 应用已在Huggingface Spaces上线
|
6 |
+
🔗 **访问地址**: [MoneyPrinterTurbo on HF Spaces](https://huggingface.co/spaces/your-username/MoneyPrinterTurbo)
|
7 |
+
|
8 |
+
### 📋 部署完成清单
|
9 |
+
- [x] 创建Huggingface Space
|
10 |
+
- [x] 上传所有项目文件
|
11 |
+
- [x] 配置启动文件 (app.py)
|
12 |
+
- [x] 设置依赖文件 (requirements.txt)
|
13 |
+
- [x] 优化FREE层级配置
|
14 |
+
- [x] 解决启动问题
|
15 |
+
|
16 |
+
---
|
17 |
+
|
18 |
+
## 🚀 快速部署步骤
|
19 |
+
|
20 |
+
### 1. 准备文件
|
21 |
+
确保以下文件已准备好:
|
22 |
+
- `app.py` - 简化的Streamlit启动文件
|
23 |
+
- `README.md` - 项目说明(从README_HF.md重命名)
|
24 |
+
- `requirements.txt` - 精简的依赖列表(从requirements_hf.txt重命名)
|
25 |
+
- `config.toml` - 预配置的设置文件
|
26 |
+
|
27 |
+
### 2. 创建Huggingface Space
|
28 |
+
1. 访问 https://huggingface.co/spaces
|
29 |
+
2. 点击 "Create new Space"
|
30 |
+
3. 选择 "Streamlit" 作为SDK
|
31 |
+
4. 设置Space名称和描述
|
32 |
+
|
33 |
+
### 3. 上传文件
|
34 |
+
将所有项目文件上传到新创建的Space,确保:
|
35 |
+
- `app.py` 作为主入口文件
|
36 |
+
- 所有必要的项目文件和目录结构完整
|
37 |
+
|
38 |
+
### 4. 配置环境变量(重要!)
|
39 |
+
|
40 |
+
在Space的Settings页面添加以下环境变量:
|
41 |
+
|
42 |
+
#### LLM服务商API密钥
|
43 |
+
```bash
|
44 |
+
DEEPSEEK_API_KEY=sk-xxxxxx # DeepSeek API密钥
|
45 |
+
MOONSHOT_API_KEY=sk-xxxxxx # Moonshot API密钥
|
46 |
+
OPENAI_API_KEY=sk-xxxxxx # OpenAI API密钥
|
47 |
+
```
|
48 |
+
|
49 |
+
#### 视频素材API密钥
|
50 |
+
```bash
|
51 |
+
PEXELS_API_KEY=xxxxxx # Pexels视频素材
|
52 |
+
PIXABAY_API_KEY=xxxxxx # Pixabay视频素材
|
53 |
+
```
|
54 |
+
|
55 |
+
#### 语音合成API密钥
|
56 |
+
```bash
|
57 |
+
AZURE_SPEECH_KEY=xxxxxx # Azure语音服务密钥
|
58 |
+
AZURE_SPEECH_REGION=eastus # Azure服务区域
|
59 |
+
```
|
60 |
+
|
61 |
+
#### 其他服务
|
62 |
+
```bash
|
63 |
+
SILICONFLOW_API_KEY=sk-xxxxxx # SiliconFlow API密钥
|
64 |
+
MONEYPRINTER_API_KEY=xxxxxx # MoneyPrinter官方API(可选)
|
65 |
+
```
|
66 |
+
|
67 |
+
---
|
68 |
+
|
69 |
+
## 🔧 问题解决方案
|
70 |
+
|
71 |
+
### ✅ 已解决的问题
|
72 |
+
|
73 |
+
1. **启动卡在"Starting"状态**
|
74 |
+
- 原因:复杂的启动逻辑和subprocess调用
|
75 |
+
- 解决:简化为直接Streamlit应用,移除subprocess启动
|
76 |
+
|
77 |
+
2. **依赖包安装失败**
|
78 |
+
- 原因:包含不兼容的系统级依赖
|
79 |
+
- 解决:使用精简的requirements_hf.txt
|
80 |
+
|
81 |
+
3. **资源超限问题**
|
82 |
+
- 原因:FREE层级资源限制
|
83 |
+
- 解决:优化配置,限制并发任务数
|
84 |
+
|
85 |
+
### 🛠️ 当前功能状态
|
86 |
+
|
87 |
+
- ✅ **基础界面**: 应用启动和配置检查
|
88 |
+
- ✅ **环境变量加载**: 自动读取HF Spaces环境变量
|
89 |
+
- ✅ **API密钥验证**: 显示已配置的服务状态
|
90 |
+
- 🔄 **视频生成**: 核心功能适配中
|
91 |
+
- 🔄 **完整界面**: 原Main.py功能迁移中
|
92 |
+
|
93 |
+
---
|
94 |
+
|
95 |
+
## 📊 API密钥获取指南
|
96 |
+
|
97 |
+
### DeepSeek API (推荐)
|
98 |
+
1. 访问 https://platform.deepseek.com/
|
99 |
+
2. 注册账户并获取API密钥
|
100 |
+
3. 新用户通常有免费额度
|
101 |
+
|
102 |
+
### Moonshot API
|
103 |
+
1. 访问 https://platform.moonshot.cn/
|
104 |
+
2. 注册并获取API密钥
|
105 |
+
3. 性价比较高的国产LLM
|
106 |
+
|
107 |
+
### Pexels API (视频素材)
|
108 |
+
1. 访问 https://www.pexels.com/api/
|
109 |
+
2. 免费注册获取API密钥
|
110 |
+
3. 每月有免费请求限额
|
111 |
+
|
112 |
+
### Azure Speech (语音合成)
|
113 |
+
1. 访问 https://azure.microsoft.com/services/cognitive-services/speech-services/
|
114 |
+
2. 创建Azure账户和Speech资源
|
115 |
+
3. 获取API密钥和区域信息
|
116 |
+
|
117 |
+
---
|
118 |
+
|
119 |
+
## 🎯 使用建议
|
120 |
+
|
121 |
+
### FREE层级最佳实践
|
122 |
+
1. **视频时长**: 建议30-60秒
|
123 |
+
2. **并发限制**: 同时只生成1个视频
|
124 |
+
3. **素材选择**: 优先使用缓存的素材
|
125 |
+
4. **API调用**: 合理控制频率
|
126 |
+
|
127 |
+
### 性能优化
|
128 |
+
- 使用简化界面减少资源占用
|
129 |
+
- 启用素材缓存机制
|
130 |
+
- 限制同时处理的任务数量
|
131 |
+
|
132 |
+
---
|
133 |
+
|
134 |
+
## 📞 技术支持
|
135 |
+
|
136 |
+
如遇到问题,请检查:
|
137 |
+
1. **Space日志**: 查看启动和运行日志
|
138 |
+
2. **环境变量**: 确认API密钥配置正确
|
139 |
+
3. **网络连接**: 确保API服务可访问
|
140 |
+
4. **资源限制**: 监控内存和CPU使用
|
141 |
+
|
142 |
+
---
|
143 |
+
|
144 |
+
## 🔄 后续计划
|
145 |
+
|
146 |
+
1. **完整功能迁移**: 逐步适配所有视频生成功能
|
147 |
+
2. **性能优化**: 进一步优化FREE层级体验
|
148 |
+
3. **用户界面**: 改进交互体验
|
149 |
+
4. **文档完善**: 添加更多使用教程
|
150 |
+
|
151 |
+
---
|
152 |
+
|
153 |
+
*最后更新: 2024年*
|
app.py
CHANGED
@@ -1,214 +1,180 @@
|
|
1 |
#!/usr/bin/env python3
|
2 |
"""
|
3 |
-
Huggingface Spaces
|
4 |
-
Optimized for FREE tier
|
5 |
"""
|
6 |
|
7 |
import os
|
8 |
import sys
|
9 |
-
import
|
10 |
import toml
|
11 |
from pathlib import Path
|
12 |
|
13 |
-
# Add
|
14 |
-
|
15 |
-
sys.path.insert(0,
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
os.makedirs("storage/tasks", exist_ok=True)
|
22 |
-
os.makedirs("storage/temp", exist_ok=True)
|
23 |
-
os.makedirs("storage/cache_videos", exist_ok=True)
|
24 |
-
os.makedirs(".streamlit", exist_ok=True)
|
25 |
-
|
26 |
-
# Create .streamlit/config.toml for proper configuration
|
27 |
-
streamlit_config = """
|
28 |
-
[server]
|
29 |
-
port = 7860
|
30 |
-
address = "0.0.0.0"
|
31 |
-
enableCORS = true
|
32 |
-
enableXsrfProtection = false
|
33 |
-
enableWebsocketCompression = false
|
34 |
-
|
35 |
-
[browser]
|
36 |
-
gatherUsageStats = false
|
37 |
-
"""
|
38 |
-
|
39 |
-
with open(".streamlit/config.toml", "w") as f:
|
40 |
-
f.write(streamlit_config)
|
41 |
-
|
42 |
-
print("✅ Directories and Streamlit config created")
|
43 |
|
44 |
-
def
|
45 |
-
"""Load environment variables
|
46 |
config_path = "config.toml"
|
47 |
|
48 |
-
#
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
except Exception:
|
60 |
-
config = {
|
61 |
-
"app": {"max_concurrent_tasks": 1, "api_enabled": True},
|
62 |
-
"ui": {"hide_log": False},
|
63 |
-
"azure": {},
|
64 |
-
"siliconflow": {}
|
65 |
-
}
|
66 |
|
67 |
# Load environment variables
|
68 |
-
|
69 |
-
# MoneyPrinter API
|
70 |
-
"MONEYPRINTER_API_KEY": ("app", "api_key"),
|
71 |
-
|
72 |
-
# LLM providers
|
73 |
"DEEPSEEK_API_KEY": ("app", "deepseek_api_key"),
|
74 |
-
"MOONSHOT_API_KEY": ("app", "moonshot_api_key"),
|
75 |
"OPENAI_API_KEY": ("app", "openai_api_key"),
|
76 |
-
|
77 |
-
# Video sources
|
78 |
"PEXELS_API_KEY": ("app", "pexels_api_keys"),
|
79 |
"PIXABAY_API_KEY": ("app", "pixabay_api_keys"),
|
80 |
-
|
81 |
-
# Azure Speech
|
82 |
"AZURE_SPEECH_KEY": ("azure", "speech_key"),
|
83 |
"AZURE_SPEECH_REGION": ("azure", "speech_region"),
|
84 |
-
|
85 |
-
# SiliconFlow
|
86 |
"SILICONFLOW_API_KEY": ("siliconflow", "api_key"),
|
|
|
87 |
}
|
88 |
|
89 |
-
|
90 |
-
for
|
91 |
-
value = os.getenv(
|
92 |
if value:
|
93 |
if section not in config:
|
94 |
config[section] = {}
|
95 |
-
|
96 |
-
|
97 |
-
if key in ["pexels_api_keys", "pixabay_api_keys"]:
|
98 |
-
config[section][key] = [value] if isinstance(value, str) else value
|
99 |
else:
|
100 |
-
config[section][
|
101 |
-
|
102 |
-
env_vars_loaded.append(env_var)
|
103 |
|
104 |
-
# Save
|
105 |
-
|
106 |
-
|
107 |
-
toml.dump(config, f)
|
108 |
-
|
109 |
-
if env_vars_loaded:
|
110 |
-
print(f"✅ Loaded environment variables: {', '.join(env_vars_loaded)}")
|
111 |
-
else:
|
112 |
-
print("ℹ️ No environment variables found, using WebUI configuration")
|
113 |
-
except Exception as e:
|
114 |
-
print(f"⚠️ Could not save config: {e}")
|
115 |
-
|
116 |
-
def optimize_for_free_tier():
|
117 |
-
"""Apply FREE tier optimizations"""
|
118 |
-
print("🔧 Applying FREE tier optimizations...")
|
119 |
|
120 |
-
|
121 |
-
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
|
130 |
-
|
131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
|
133 |
-
if
|
134 |
-
|
135 |
-
|
|
|
136 |
else:
|
137 |
-
|
138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
"--server.address", "0.0.0.0",
|
146 |
-
"--server.enableCORS", "true",
|
147 |
-
"--server.enableXsrfProtection", "false",
|
148 |
-
"--browser.gatherUsageStats", "false"
|
149 |
-
], check=True)
|
150 |
-
except subprocess.CalledProcessError as e:
|
151 |
-
print(f"❌ Failed to start Streamlit: {e}")
|
152 |
-
# Fallback to simple HTTP server
|
153 |
-
print("🔄 Falling back to simple HTTP server...")
|
154 |
-
|
155 |
-
# Create a simple status page
|
156 |
-
html_content = """<!DOCTYPE html>
|
157 |
-
<html>
|
158 |
-
<head>
|
159 |
-
<title>MoneyPrinterTurbo - Starting</title>
|
160 |
-
<meta charset="utf-8">
|
161 |
-
<style>
|
162 |
-
body { font-family: Arial, sans-serif; text-align: center; padding: 50px; }
|
163 |
-
.container { max-width: 600px; margin: 0 auto; }
|
164 |
-
h1 { color: #4CAF50; }
|
165 |
-
.status { padding: 20px; background: #f0f8ff; border-radius: 10px; margin: 20px 0; }
|
166 |
-
</style>
|
167 |
-
</head>
|
168 |
-
<body>
|
169 |
-
<div class="container">
|
170 |
-
<h1>🎬 MoneyPrinterTurbo</h1>
|
171 |
-
<div class="status">
|
172 |
-
<h2>🔄 应用启动中...</h2>
|
173 |
-
<p>Streamlit 启动失败,正在尝试备用方案。</p>
|
174 |
-
<p>请稍后刷新页面或检查日志获取更多信息。</p>
|
175 |
-
</div>
|
176 |
-
</div>
|
177 |
-
</body>
|
178 |
-
</html>"""
|
179 |
-
|
180 |
-
with open("index.html", "w", encoding="utf-8") as f:
|
181 |
-
f.write(html_content)
|
182 |
-
|
183 |
-
subprocess.run([
|
184 |
-
sys.executable, "-m", "http.server", "7860",
|
185 |
-
"--bind", "0.0.0.0"
|
186 |
-
])
|
187 |
-
|
188 |
-
if __name__ == "__main__":
|
189 |
-
print("🎬 MoneyPrinterTurbo - Huggingface Spaces Edition")
|
190 |
-
print("=" * 50)
|
191 |
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
|
|
|
1 |
#!/usr/bin/env python3
|
2 |
"""
|
3 |
+
MoneyPrinterTurbo - Huggingface Spaces Edition
|
4 |
+
Optimized for FREE tier deployment
|
5 |
"""
|
6 |
|
7 |
import os
|
8 |
import sys
|
9 |
+
import streamlit as st
|
10 |
import toml
|
11 |
from pathlib import Path
|
12 |
|
13 |
+
# Add project root to Python path
|
14 |
+
project_root = Path(__file__).parent
|
15 |
+
sys.path.insert(0, str(project_root))
|
16 |
+
|
17 |
+
# Create necessary directories
|
18 |
+
os.makedirs("storage/tasks", exist_ok=True)
|
19 |
+
os.makedirs("storage/temp", exist_ok=True)
|
20 |
+
os.makedirs("storage/cache_videos", exist_ok=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
+
def load_config():
|
23 |
+
"""Load configuration from environment variables"""
|
24 |
config_path = "config.toml"
|
25 |
|
26 |
+
# Default configuration
|
27 |
+
config = {
|
28 |
+
"app": {
|
29 |
+
"max_concurrent_tasks": 1,
|
30 |
+
"api_enabled": True,
|
31 |
+
"log_level": "INFO"
|
32 |
+
},
|
33 |
+
"ui": {"hide_log": False, "language": "zh"},
|
34 |
+
"azure": {},
|
35 |
+
"siliconflow": {}
|
36 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
# Load environment variables
|
39 |
+
env_vars = {
|
|
|
|
|
|
|
|
|
40 |
"DEEPSEEK_API_KEY": ("app", "deepseek_api_key"),
|
41 |
+
"MOONSHOT_API_KEY": ("app", "moonshot_api_key"),
|
42 |
"OPENAI_API_KEY": ("app", "openai_api_key"),
|
|
|
|
|
43 |
"PEXELS_API_KEY": ("app", "pexels_api_keys"),
|
44 |
"PIXABAY_API_KEY": ("app", "pixabay_api_keys"),
|
|
|
|
|
45 |
"AZURE_SPEECH_KEY": ("azure", "speech_key"),
|
46 |
"AZURE_SPEECH_REGION": ("azure", "speech_region"),
|
|
|
|
|
47 |
"SILICONFLOW_API_KEY": ("siliconflow", "api_key"),
|
48 |
+
"MONEYPRINTER_API_KEY": ("app", "api_key")
|
49 |
}
|
50 |
|
51 |
+
loaded_keys = []
|
52 |
+
for env_key, (section, config_key) in env_vars.items():
|
53 |
+
value = os.getenv(env_key)
|
54 |
if value:
|
55 |
if section not in config:
|
56 |
config[section] = {}
|
57 |
+
if config_key.endswith("_keys"):
|
58 |
+
config[section][config_key] = [value]
|
|
|
|
|
59 |
else:
|
60 |
+
config[section][config_key] = value
|
61 |
+
loaded_keys.append(env_key)
|
|
|
62 |
|
63 |
+
# Save configuration
|
64 |
+
with open(config_path, 'w', encoding='utf-8') as f:
|
65 |
+
toml.dump(config, f)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
+
return config, loaded_keys
|
68 |
+
|
69 |
+
# Load configuration
|
70 |
+
config, loaded_env_vars = load_config()
|
71 |
+
|
72 |
+
# Set Streamlit page config
|
73 |
+
st.set_page_config(
|
74 |
+
page_title="MoneyPrinterTurbo - HF Spaces",
|
75 |
+
page_icon="🎬",
|
76 |
+
layout="wide",
|
77 |
+
initial_sidebar_state="expanded"
|
78 |
+
)
|
79 |
+
|
80 |
+
# Custom CSS
|
81 |
+
st.markdown("""
|
82 |
+
<style>
|
83 |
+
.main > div {
|
84 |
+
padding-top: 2rem;
|
85 |
+
}
|
86 |
+
.stAlert {
|
87 |
+
margin-top: 1rem;
|
88 |
+
}
|
89 |
+
</style>
|
90 |
+
""", unsafe_allow_html=True)
|
91 |
+
|
92 |
+
# Main UI
|
93 |
+
st.title("🎬 MoneyPrinterTurbo")
|
94 |
+
st.markdown("### AI视频生成工具 - Huggingface Spaces版")
|
95 |
+
|
96 |
+
# Status display
|
97 |
+
with st.container():
|
98 |
+
col1, col2 = st.columns(2)
|
99 |
|
100 |
+
with col1:
|
101 |
+
st.success("✅ 应用已成功启动")
|
102 |
+
st.info(f"📊 环境变量加载: {len(loaded_env_vars)} 个")
|
103 |
+
|
104 |
+
with col2:
|
105 |
+
st.warning("⚠️ 这是简化版界面")
|
106 |
+
st.info("🔧 为FREE层级优化")
|
107 |
+
|
108 |
+
# Configuration status
|
109 |
+
st.subheader("📋 配置状态")
|
110 |
+
config_status = st.container()
|
111 |
|
112 |
+
with config_status:
|
113 |
+
# Check API keys
|
114 |
+
api_keys_status = []
|
115 |
|
116 |
+
if config.get("app", {}).get("deepseek_api_key"):
|
117 |
+
api_keys_status.append("✅ DeepSeek API")
|
118 |
+
if config.get("app", {}).get("moonshot_api_key"):
|
119 |
+
api_keys_status.append("✅ Moonshot API")
|
120 |
+
if config.get("app", {}).get("openai_api_key"):
|
121 |
+
api_keys_status.append("✅ OpenAI API")
|
122 |
+
if config.get("app", {}).get("pexels_api_keys"):
|
123 |
+
api_keys_status.append("✅ Pexels API")
|
124 |
+
if config.get("azure", {}).get("speech_key"):
|
125 |
+
api_keys_status.append("✅ Azure Speech")
|
126 |
|
127 |
+
if api_keys_status:
|
128 |
+
st.success("🔑 已配置的API密钥:")
|
129 |
+
for status in api_keys_status:
|
130 |
+
st.write(f" {status}")
|
131 |
else:
|
132 |
+
st.error("❌ 未检测到API密钥配置")
|
133 |
+
st.info("💡 请在Huggingface Spaces设置中添加环境变量")
|
134 |
+
|
135 |
+
# Instructions
|
136 |
+
st.subheader("🚀 使用说明")
|
137 |
+
st.markdown("""
|
138 |
+
1. **配置API密钥**: 在Huggingface Spaces的Settings中添加环境变量
|
139 |
+
2. **选择功能**: 使用下方的功能模块开始创建视频
|
140 |
+
3. **注意限制**: FREE层级有资源限制,建议生成较短的视频
|
141 |
+
""")
|
142 |
+
|
143 |
+
# Quick actions
|
144 |
+
st.subheader("⚡ 快速操作")
|
145 |
+
|
146 |
+
# Simple video generation form
|
147 |
+
with st.form("quick_video"):
|
148 |
+
video_topic = st.text_input("视频主题", placeholder="例如: 介绍人工智能的发展历史")
|
149 |
+
video_duration = st.slider("视频时长 (秒)", 30, 120, 60)
|
150 |
|
151 |
+
col1, col2 = st.columns(2)
|
152 |
+
with col1:
|
153 |
+
video_style = st.selectbox("视频风格", ["科技", "生活", "教育", "娱乐"])
|
154 |
+
with col2:
|
155 |
+
video_language = st.selectbox("语言", ["中文", "英文"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
|
157 |
+
submitted = st.form_submit_button("🎬 生成视频")
|
158 |
+
|
159 |
+
if submitted:
|
160 |
+
if not video_topic:
|
161 |
+
st.error("请输入视频主题")
|
162 |
+
elif not api_keys_status:
|
163 |
+
st.error("请先配置API密钥")
|
164 |
+
else:
|
165 |
+
with st.spinner("正在生成视频..."):
|
166 |
+
st.info("🔄 视频生成功能正在开发中")
|
167 |
+
st.success("✅ 配置已保存,等待完整功能上线")
|
168 |
+
|
169 |
+
# Footer
|
170 |
+
st.markdown("---")
|
171 |
+
st.markdown("💡 **提示**: 完整版功能正在适配中,敬请期待!")
|
172 |
+
|
173 |
+
# Debug info (for development)
|
174 |
+
if st.checkbox("显示调试信息"):
|
175 |
+
st.subheader("🔍 调试信息")
|
176 |
+
st.json({
|
177 |
+
"loaded_env_vars": loaded_env_vars,
|
178 |
+
"config_sections": list(config.keys()),
|
179 |
+
"storage_dirs": ["storage/tasks", "storage/temp", "storage/cache_videos"]
|
180 |
+
})
|