#!/usr/bin/env python3
"""
Ultra-minimal test version for Huggingface Spaces
"""
import subprocess
import sys
import os
print("🚀 Starting ultra-minimal MoneyPrinterTurbo...")
# Create basic directories
os.makedirs("storage/tasks", exist_ok=True)
os.makedirs("storage/temp", exist_ok=True)
# Create a test HTML page instead of Streamlit
test_html = """
MoneyPrinterTurbo - Test Version
🎬 MoneyPrinterTurbo
AI驱动的短视频生成工具 - 测试版本
✅ 部署测试成功!
恭喜!如果您看到这个页面,说明 Huggingface Spaces 基础架构运行正常。
📋 测试结果
✅ Python 环境:正常
✅ 端口配置:7860 端口访问正常
✅ 文件系统:存储目录创建成功
✅ HTTP 服务:Python 内置服务器运行正常
🔄 下一步部署计划
- 阶段 1:零依赖测试 ✅
- 阶段 2:添加 Streamlit 依赖
- 阶段 3:添加核心依赖包
- 阶段 4:完整功能部署
📝 部署说明
这是一个分阶段部署策略:
- 当前版本:仅使用 Python 标准库,验证基础环境
- 优势:构建速度快,启动迅速,便于问题排查
- 目的:确认 HF Spaces 环境配置正确
"""
# Write test 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 to start a simple HTTP server instead of Streamlit
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}")
# Fallback to just keeping the process alive
import time
print("🔄 Falling back to keep-alive mode...")
while True:
print("⏰ Keeping process alive...")
time.sleep(30)