Upload 4 files
Browse files- app.py +101 -0
- config.toml +14 -0
- packages.txt +1 -0
- requirements.txt +2 -0
    	
        app.py
    ADDED
    
    | @@ -0,0 +1,101 @@ | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            #!/usr/bin/env python3
         | 
| 2 | 
            +
            """
         | 
| 3 | 
            +
            Ultra-minimal test version for Huggingface Spaces
         | 
| 4 | 
            +
            """
         | 
| 5 | 
            +
            import subprocess
         | 
| 6 | 
            +
            import sys
         | 
| 7 | 
            +
            import os
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            print("🚀 Starting ultra-minimal MoneyPrinterTurbo...")
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            # Create basic directories
         | 
| 12 | 
            +
            os.makedirs("storage/tasks", exist_ok=True)
         | 
| 13 | 
            +
            os.makedirs("storage/temp", exist_ok=True)
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            # Create a test HTML page instead of Streamlit
         | 
| 16 | 
            +
            test_html = """<!DOCTYPE html>
         | 
| 17 | 
            +
            <html>
         | 
| 18 | 
            +
            <head>
         | 
| 19 | 
            +
                <title>MoneyPrinterTurbo - Test Version</title>
         | 
| 20 | 
            +
                <style>
         | 
| 21 | 
            +
                    body { font-family: Arial, sans-serif; text-align: center; padding: 50px; background: #f5f5f5; }
         | 
| 22 | 
            +
                    .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); }
         | 
| 23 | 
            +
                    h1 { color: #4CAF50; margin-bottom: 10px; }
         | 
| 24 | 
            +
                    .subtitle { color: #666; margin-bottom: 30px; }
         | 
| 25 | 
            +
                    .status { padding: 20px; background: #e8f5e8; border-radius: 8px; margin: 20px 0; border-left: 4px solid #4CAF50; }
         | 
| 26 | 
            +
                    .info { padding: 15px; background: #f0f8ff; border-radius: 8px; margin: 15px 0; }
         | 
| 27 | 
            +
                    .step { text-align: left; margin: 10px 0; }
         | 
| 28 | 
            +
                    .success { color: #4CAF50; font-weight: bold; }
         | 
| 29 | 
            +
                    .next { color: #2196F3; }
         | 
| 30 | 
            +
                    ul { text-align: left; }
         | 
| 31 | 
            +
                    .footer { margin-top: 40px; padding-top: 20px; border-top: 1px solid #eee; color: #888; font-size: 14px; }
         | 
| 32 | 
            +
                </style>
         | 
| 33 | 
            +
            </head>
         | 
| 34 | 
            +
            <body>
         | 
| 35 | 
            +
                <div class="container">
         | 
| 36 | 
            +
                    <h1>🎬 MoneyPrinterTurbo</h1>
         | 
| 37 | 
            +
                    <p class="subtitle">AI驱动的短视频生成工具 - 测试版本</p>
         | 
| 38 | 
            +
                    
         | 
| 39 | 
            +
                    <div class="status">
         | 
| 40 | 
            +
                        <h2 class="success">✅ 部署测试成功!</h2>
         | 
| 41 | 
            +
                        <p>恭喜!如果您看到这个页面,说明 Huggingface Spaces 基础架构运行正常。</p>
         | 
| 42 | 
            +
                    </div>
         | 
| 43 | 
            +
                    
         | 
| 44 | 
            +
                    <div class="info">
         | 
| 45 | 
            +
                        <h3>📋 测试结果</h3>
         | 
| 46 | 
            +
                        <div class="step">✅ Python 环境:正常</div>
         | 
| 47 | 
            +
                        <div class="step">✅ 端口配置:7860 端口访问正常</div>
         | 
| 48 | 
            +
                        <div class="step">✅ 文件系统:存储目录创建成功</div>
         | 
| 49 | 
            +
                        <div class="step">✅ HTTP 服务:Python 内置服务器运行正常</div>
         | 
| 50 | 
            +
                    </div>
         | 
| 51 | 
            +
                    
         | 
| 52 | 
            +
                    <div class="info">
         | 
| 53 | 
            +
                        <h3>🔄 下一步部署计划</h3>
         | 
| 54 | 
            +
                        <ul>
         | 
| 55 | 
            +
                            <li><span class="success">阶段 1</span>:零依赖测试 ✅</li>
         | 
| 56 | 
            +
                            <li><span class="next">阶段 2</span>:添加 Streamlit 依赖</li>
         | 
| 57 | 
            +
                            <li><span class="next">阶段 3</span>:添加核心依赖包</li>
         | 
| 58 | 
            +
                            <li><span class="next">阶段 4</span>:完整功能部署</li>
         | 
| 59 | 
            +
                        </ul>
         | 
| 60 | 
            +
                    </div>
         | 
| 61 | 
            +
                    
         | 
| 62 | 
            +
                    <div class="info">
         | 
| 63 | 
            +
                        <h3>📝 部署说明</h3>
         | 
| 64 | 
            +
                        <p>这是一个分阶段部署策略:</p>
         | 
| 65 | 
            +
                        <ul>
         | 
| 66 | 
            +
                            <li><strong>当前版本</strong>:仅使用 Python 标准库,验证基础环境</li>
         | 
| 67 | 
            +
                            <li><strong>优势</strong>:构建速度快,启动迅速,便于问题排查</li>
         | 
| 68 | 
            +
                            <li><strong>目的</strong>:确认 HF Spaces 环境配置正确</li>
         | 
| 69 | 
            +
                        </ul>
         | 
| 70 | 
            +
                    </div>
         | 
| 71 | 
            +
                    
         | 
| 72 | 
            +
                    <div class="footer">
         | 
| 73 | 
            +
                        <p>MoneyPrinterTurbo v1.2.6 | Powered by Huggingface Spaces</p>
         | 
| 74 | 
            +
                        <p>测试时间: <script>document.write(new Date().toLocaleString());</script></p>
         | 
| 75 | 
            +
                    </div>
         | 
| 76 | 
            +
                </div>
         | 
| 77 | 
            +
            </body>
         | 
| 78 | 
            +
            </html>"""
         | 
| 79 | 
            +
             | 
| 80 | 
            +
            # Write test HTML
         | 
| 81 | 
            +
            with open("index.html", "w", encoding="utf-8") as f:
         | 
| 82 | 
            +
                f.write(test_html)
         | 
| 83 | 
            +
             | 
| 84 | 
            +
            print("✅ Test HTML created successfully")
         | 
| 85 | 
            +
            print(f"📂 Storage directories created: storage/tasks, storage/temp")
         | 
| 86 | 
            +
             | 
| 87 | 
            +
            # Try to start a simple HTTP server instead of Streamlit
         | 
| 88 | 
            +
            try:
         | 
| 89 | 
            +
                print(f"🌐 Starting HTTP server on port 7860...")
         | 
| 90 | 
            +
                subprocess.run([
         | 
| 91 | 
            +
                    sys.executable, "-m", "http.server", "7860", 
         | 
| 92 | 
            +
                    "--bind", "0.0.0.0"
         | 
| 93 | 
            +
                ])
         | 
| 94 | 
            +
            except Exception as e:
         | 
| 95 | 
            +
                print(f"❌ Failed to start server: {e}")
         | 
| 96 | 
            +
                # Fallback to just keeping the process alive
         | 
| 97 | 
            +
                import time
         | 
| 98 | 
            +
                print("🔄 Falling back to keep-alive mode...")
         | 
| 99 | 
            +
                while True:
         | 
| 100 | 
            +
                    print("⏰ Keeping process alive...")
         | 
| 101 | 
            +
                    time.sleep(30)
         | 
    	
        config.toml
    ADDED
    
    | @@ -0,0 +1,14 @@ | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            [app]
         | 
| 2 | 
            +
            max_concurrent_tasks = 1
         | 
| 3 | 
            +
            api_enabled = true
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            [ui]
         | 
| 6 | 
            +
            hide_log = false
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            [azure]
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            [siliconflow]
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            [whisper]
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            [proxy]
         | 
    	
        packages.txt
    ADDED
    
    | @@ -0,0 +1 @@ | |
|  | 
|  | |
| 1 | 
            +
            # No system packages needed for basic test
         | 
    	
        requirements.txt
    ADDED
    
    | @@ -0,0 +1,2 @@ | |
|  | |
|  | 
|  | |
| 1 | 
            +
            # Ultra-minimal requirements for testing deployment
         | 
| 2 | 
            +
            # No dependencies - using only Python standard library
         |