|
|
|
"""
|
|
Ultra-minimal test version for Huggingface Spaces
|
|
"""
|
|
import subprocess
|
|
import sys
|
|
import os
|
|
|
|
print("🚀 Starting ultra-minimal MoneyPrinterTurbo...")
|
|
|
|
|
|
os.makedirs("storage/tasks", exist_ok=True)
|
|
os.makedirs("storage/temp", exist_ok=True)
|
|
|
|
|
|
test_html = """<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>MoneyPrinterTurbo - Test Version</title>
|
|
<style>
|
|
body { font-family: Arial, sans-serif; text-align: center; padding: 50px; background: #f5f5f5; }
|
|
.container { max-width: 800px; margin: 0 auto; background: white; padding: 40px; border-radius: 10px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
|
|
h1 { color: #4CAF50; margin-bottom: 10px; }
|
|
.subtitle { color: #666; margin-bottom: 30px; }
|
|
.status { padding: 20px; background: #e8f5e8; border-radius: 8px; margin: 20px 0; border-left: 4px solid #4CAF50; }
|
|
.info { padding: 15px; background: #f0f8ff; border-radius: 8px; margin: 15px 0; }
|
|
.step { text-align: left; margin: 10px 0; }
|
|
.success { color: #4CAF50; font-weight: bold; }
|
|
.next { color: #2196F3; }
|
|
ul { text-align: left; }
|
|
.footer { margin-top: 40px; padding-top: 20px; border-top: 1px solid #eee; color: #888; font-size: 14px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>🎬 MoneyPrinterTurbo</h1>
|
|
<p class="subtitle">AI驱动的短视频生成工具 - 测试版本</p>
|
|
|
|
<div class="status">
|
|
<h2 class="success">✅ 部署测试成功!</h2>
|
|
<p>恭喜!如果您看到这个页面,说明 Huggingface Spaces 基础架构运行正常。</p>
|
|
</div>
|
|
|
|
<div class="info">
|
|
<h3>📋 测试结果</h3>
|
|
<div class="step">✅ Python 环境:正常</div>
|
|
<div class="step">✅ 端口配置:7860 端口访问正常</div>
|
|
<div class="step">✅ 文件系统:存储目录创建成功</div>
|
|
<div class="step">✅ HTTP 服务:Python 内置服务器运行正常</div>
|
|
</div>
|
|
|
|
<div class="info">
|
|
<h3>🔄 下一步部署计划</h3>
|
|
<ul>
|
|
<li><span class="success">阶段 1</span>:零依赖测试 ✅</li>
|
|
<li><span class="next">阶段 2</span>:添加 Streamlit 依赖</li>
|
|
<li><span class="next">阶段 3</span>:添加核心依赖包</li>
|
|
<li><span class="next">阶段 4</span>:完整功能部署</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="info">
|
|
<h3>📝 部署说明</h3>
|
|
<p>这是一个分阶段部署策略:</p>
|
|
<ul>
|
|
<li><strong>当前版本</strong>:仅使用 Python 标准库,验证基础环境</li>
|
|
<li><strong>优势</strong>:构建速度快,启动迅速,便于问题排查</li>
|
|
<li><strong>目的</strong>:确认 HF Spaces 环境配置正确</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="footer">
|
|
<p>MoneyPrinterTurbo v1.2.6 | Powered by Huggingface Spaces</p>
|
|
<p>测试时间: <script>document.write(new Date().toLocaleString());</script></p>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>"""
|
|
|
|
|
|
with open("index.html", "w", encoding="utf-8") as f:
|
|
f.write(test_html)
|
|
|
|
print("✅ Test HTML created successfully")
|
|
print(f"📂 Storage directories created: storage/tasks, storage/temp")
|
|
|
|
|
|
try:
|
|
print(f"🌐 Starting HTTP server on port 7860...")
|
|
subprocess.run([
|
|
sys.executable, "-m", "http.server", "7860",
|
|
"--bind", "0.0.0.0"
|
|
])
|
|
except Exception as e:
|
|
print(f"❌ Failed to start server: {e}")
|
|
|
|
import time
|
|
print("🔄 Falling back to keep-alive mode...")
|
|
while True:
|
|
print("⏰ Keeping process alive...")
|
|
time.sleep(30) |