Upload 5 files
Browse files- config.example.toml +214 -0
- packages.txt +30 -0
- requirements_hf.txt +51 -0
- streamlit_app.py +125 -0
config.example.toml
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[app]
|
| 2 |
+
video_source = "pexels" # "pexels" or "pixabay"
|
| 3 |
+
|
| 4 |
+
# 是否隐藏配置面板
|
| 5 |
+
hide_config = false
|
| 6 |
+
|
| 7 |
+
# Pexels API Key
|
| 8 |
+
# Register at https://www.pexels.com/api/ to get your API key.
|
| 9 |
+
# You can use multiple keys to avoid rate limits.
|
| 10 |
+
# For example: pexels_api_keys = ["123adsf4567adf89","abd1321cd13efgfdfhi"]
|
| 11 |
+
# 特别注意格式,Key 用英文双引号括起来,多个Key用逗号隔开
|
| 12 |
+
pexels_api_keys = []
|
| 13 |
+
|
| 14 |
+
# Pixabay API Key
|
| 15 |
+
# Register at https://pixabay.com/api/docs/ to get your API key.
|
| 16 |
+
# You can use multiple keys to avoid rate limits.
|
| 17 |
+
# For example: pixabay_api_keys = ["123adsf4567adf89","abd1321cd13efgfdfhi"]
|
| 18 |
+
# 特别注意格式,Key 用英文双引号括起来,多个Key用逗号隔开
|
| 19 |
+
pixabay_api_keys = []
|
| 20 |
+
|
| 21 |
+
# 支持的提供商 (Supported providers):
|
| 22 |
+
# openai
|
| 23 |
+
# moonshot (月之暗面)
|
| 24 |
+
# azure
|
| 25 |
+
# qwen (通义千问)
|
| 26 |
+
# deepseek
|
| 27 |
+
# gemini
|
| 28 |
+
# ollama
|
| 29 |
+
# g4f
|
| 30 |
+
# oneapi
|
| 31 |
+
# cloudflare
|
| 32 |
+
# ernie (文心一言)
|
| 33 |
+
llm_provider = "openai"
|
| 34 |
+
|
| 35 |
+
########## Pollinations AI Settings
|
| 36 |
+
# Visit https://pollinations.ai/ to learn more
|
| 37 |
+
# API Key is optional - leave empty for public access
|
| 38 |
+
pollinations_api_key = ""
|
| 39 |
+
# Default base URL for Pollinations API
|
| 40 |
+
pollinations_base_url = "https://pollinations.ai/api/v1"
|
| 41 |
+
# Default model for text generation
|
| 42 |
+
pollinations_model_name = "openai-fast"
|
| 43 |
+
|
| 44 |
+
########## Ollama Settings
|
| 45 |
+
# No need to set it unless you want to use your own proxy
|
| 46 |
+
ollama_base_url = ""
|
| 47 |
+
# Check your available models at https://ollama.com/library
|
| 48 |
+
ollama_model_name = ""
|
| 49 |
+
|
| 50 |
+
########## OpenAI API Key
|
| 51 |
+
# Get your API key at https://platform.openai.com/api-keys
|
| 52 |
+
openai_api_key = ""
|
| 53 |
+
# No need to set it unless you want to use your own proxy
|
| 54 |
+
openai_base_url = ""
|
| 55 |
+
# Check your available models at https://platform.openai.com/account/limits
|
| 56 |
+
openai_model_name = "gpt-4o-mini"
|
| 57 |
+
|
| 58 |
+
########## Moonshot API Key
|
| 59 |
+
# Visit https://platform.moonshot.cn/console/api-keys to get your API key.
|
| 60 |
+
moonshot_api_key = ""
|
| 61 |
+
moonshot_base_url = "https://api.moonshot.cn/v1"
|
| 62 |
+
moonshot_model_name = "moonshot-v1-8k"
|
| 63 |
+
|
| 64 |
+
########## OneAPI API Key
|
| 65 |
+
# Visit https://github.com/songquanpeng/one-api to get your API key
|
| 66 |
+
oneapi_api_key = ""
|
| 67 |
+
oneapi_base_url = ""
|
| 68 |
+
oneapi_model_name = ""
|
| 69 |
+
|
| 70 |
+
########## G4F
|
| 71 |
+
# Visit https://github.com/xtekky/gpt4free to get more details
|
| 72 |
+
# Supported model list: https://github.com/xtekky/gpt4free/blob/main/g4f/models.py
|
| 73 |
+
g4f_model_name = "gpt-3.5-turbo"
|
| 74 |
+
|
| 75 |
+
########## Azure API Key
|
| 76 |
+
# Visit https://learn.microsoft.com/zh-cn/azure/ai-services/openai/ to get more details
|
| 77 |
+
# API documentation: https://learn.microsoft.com/zh-cn/azure/ai-services/openai/reference
|
| 78 |
+
azure_api_key = ""
|
| 79 |
+
azure_base_url = ""
|
| 80 |
+
azure_model_name = "gpt-35-turbo" # replace with your model deployment name
|
| 81 |
+
azure_api_version = "2024-02-15-preview"
|
| 82 |
+
|
| 83 |
+
########## Gemini API Key
|
| 84 |
+
gemini_api_key = ""
|
| 85 |
+
gemini_model_name = "gemini-1.0-pro"
|
| 86 |
+
|
| 87 |
+
########## Qwen API Key
|
| 88 |
+
# Visit https://dashscope.console.aliyun.com/apiKey to get your API key
|
| 89 |
+
# Visit below links to get more details
|
| 90 |
+
# https://tongyi.aliyun.com/qianwen/
|
| 91 |
+
# https://help.aliyun.com/zh/dashscope/developer-reference/model-introduction
|
| 92 |
+
qwen_api_key = ""
|
| 93 |
+
qwen_model_name = "qwen-max"
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
########## DeepSeek API Key
|
| 97 |
+
# Visit https://platform.deepseek.com/api_keys to get your API key
|
| 98 |
+
deepseek_api_key = ""
|
| 99 |
+
deepseek_base_url = "https://api.deepseek.com"
|
| 100 |
+
deepseek_model_name = "deepseek-chat"
|
| 101 |
+
|
| 102 |
+
# Subtitle Provider, "edge" or "whisper"
|
| 103 |
+
# If empty, the subtitle will not be generated
|
| 104 |
+
subtitle_provider = "edge"
|
| 105 |
+
|
| 106 |
+
#
|
| 107 |
+
# ImageMagick
|
| 108 |
+
#
|
| 109 |
+
# Once you have installed it, ImageMagick will be automatically detected, except on Windows!
|
| 110 |
+
# On Windows, for example "C:\Program Files (x86)\ImageMagick-7.1.1-Q16-HDRI\magick.exe"
|
| 111 |
+
# Download from https://imagemagick.org/archive/binaries/ImageMagick-7.1.1-29-Q16-x64-static.exe
|
| 112 |
+
|
| 113 |
+
# imagemagick_path = "C:\\Program Files (x86)\\ImageMagick-7.1.1-Q16\\magick.exe"
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
#
|
| 117 |
+
# FFMPEG
|
| 118 |
+
#
|
| 119 |
+
# 通常情况下,ffmpeg 会被自动下载,并且会被自动检测到。
|
| 120 |
+
# 但是如果你的环境有问题,无法自动下载,可能会遇到如下错误:
|
| 121 |
+
# RuntimeError: No ffmpeg exe could be found.
|
| 122 |
+
# Install ffmpeg on your system, or set the IMAGEIO_FFMPEG_EXE environment variable.
|
| 123 |
+
# 此时你可以手动下载 ffmpeg 并设置 ffmpeg_path,下载地址:https://www.gyan.dev/ffmpeg/builds/
|
| 124 |
+
|
| 125 |
+
# Under normal circumstances, ffmpeg is downloaded automatically and detected automatically.
|
| 126 |
+
# However, if there is an issue with your environment that prevents automatic downloading, you might encounter the following error:
|
| 127 |
+
# RuntimeError: No ffmpeg exe could be found.
|
| 128 |
+
# Install ffmpeg on your system, or set the IMAGEIO_FFMPEG_EXE environment variable.
|
| 129 |
+
# In such cases, you can manually download ffmpeg and set the ffmpeg_path, download link: https://www.gyan.dev/ffmpeg/builds/
|
| 130 |
+
|
| 131 |
+
# ffmpeg_path = "C:\\Users\\harry\\Downloads\\ffmpeg.exe"
|
| 132 |
+
#########################################################################################
|
| 133 |
+
|
| 134 |
+
# 当视频生成成功后,API服务提供的视频下载接入点,默认为当前服务的地址和监听端口
|
| 135 |
+
# 比如 http://127.0.0.1:8080/tasks/6357f542-a4e1-46a1-b4c9-bf3bd0df5285/final-1.mp4
|
| 136 |
+
# 如果你需要使用域名对外提供服务(一般会用nginx做代理),则可以设置为你的域名
|
| 137 |
+
# 比如 https://xxxx.com/tasks/6357f542-a4e1-46a1-b4c9-bf3bd0df5285/final-1.mp4
|
| 138 |
+
# endpoint="https://xxxx.com"
|
| 139 |
+
|
| 140 |
+
# When the video is successfully generated, the API service provides a download endpoint for the video, defaulting to the service's current address and listening port.
|
| 141 |
+
# For example, http://127.0.0.1:8080/tasks/6357f542-a4e1-46a1-b4c9-bf3bd0df5285/final-1.mp4
|
| 142 |
+
# If you need to provide the service externally using a domain name (usually done with nginx as a proxy), you can set it to your domain name.
|
| 143 |
+
# For example, https://xxxx.com/tasks/6357f542-a4e1-46a1-b4c9-bf3bd0df5285/final-1.mp4
|
| 144 |
+
# endpoint="https://xxxx.com"
|
| 145 |
+
endpoint = ""
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
# Video material storage location
|
| 149 |
+
# material_directory = "" # Indicates that video materials will be downloaded to the default folder, the default folder is ./storage/cache_videos under the current project
|
| 150 |
+
# material_directory = "/user/harry/videos" # Indicates that video materials will be downloaded to a specified folder
|
| 151 |
+
# material_directory = "task" # Indicates that video materials will be downloaded to the current task's folder, this method does not allow sharing of already downloaded video materials
|
| 152 |
+
|
| 153 |
+
# 视频素材存放位置
|
| 154 |
+
# material_directory = "" #表示将视频素材下载到默认的文件夹,默认文件夹为当前项目下的 ./storage/cache_videos
|
| 155 |
+
# material_directory = "/user/harry/videos" #表示将视频素材下载到指定的文件夹中
|
| 156 |
+
# material_directory = "task" #表示将视频素材下载到当前任务的文件夹中,这种方式无法共享已经下载的视频素材
|
| 157 |
+
|
| 158 |
+
material_directory = ""
|
| 159 |
+
|
| 160 |
+
# Used for state management of the task
|
| 161 |
+
enable_redis = false
|
| 162 |
+
redis_host = "localhost"
|
| 163 |
+
redis_port = 6379
|
| 164 |
+
redis_db = 0
|
| 165 |
+
redis_password = ""
|
| 166 |
+
|
| 167 |
+
# 文生视频时的最大并发任务数
|
| 168 |
+
max_concurrent_tasks = 5
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
[whisper]
|
| 172 |
+
# Only effective when subtitle_provider is "whisper"
|
| 173 |
+
|
| 174 |
+
# Run on GPU with FP16
|
| 175 |
+
# model = WhisperModel(model_size, device="cuda", compute_type="float16")
|
| 176 |
+
|
| 177 |
+
# Run on GPU with INT8
|
| 178 |
+
# model = WhisperModel(model_size, device="cuda", compute_type="int8_float16")
|
| 179 |
+
|
| 180 |
+
# Run on CPU with INT8
|
| 181 |
+
# model = WhisperModel(model_size, device="cpu", compute_type="int8")
|
| 182 |
+
|
| 183 |
+
# recommended model_size: "large-v3"
|
| 184 |
+
model_size = "large-v3"
|
| 185 |
+
# if you want to use GPU, set device="cuda"
|
| 186 |
+
device = "CPU"
|
| 187 |
+
compute_type = "int8"
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
[proxy]
|
| 191 |
+
### Use a proxy to access the Pexels API
|
| 192 |
+
### Format: "http://<username>:<password>@<proxy>:<port>"
|
| 193 |
+
### Example: "http://user:pass@proxy:1234"
|
| 194 |
+
### Doc: https://requests.readthedocs.io/en/latest/user/advanced/#proxies
|
| 195 |
+
|
| 196 |
+
# http = "http://10.10.1.10:3128"
|
| 197 |
+
# https = "http://10.10.1.10:1080"
|
| 198 |
+
|
| 199 |
+
[azure]
|
| 200 |
+
# Azure Speech API Key
|
| 201 |
+
# Get your API key at https://portal.azure.com/#view/Microsoft_Azure_ProjectOxford/CognitiveServicesHub/~/SpeechServices
|
| 202 |
+
speech_key = ""
|
| 203 |
+
speech_region = ""
|
| 204 |
+
|
| 205 |
+
[siliconflow]
|
| 206 |
+
# SiliconFlow API Key
|
| 207 |
+
# Get your API key at https://siliconflow.cn
|
| 208 |
+
api_key = ""
|
| 209 |
+
|
| 210 |
+
[ui]
|
| 211 |
+
# UI related settings
|
| 212 |
+
# 是否隐藏日志信息
|
| 213 |
+
# Whether to hide logs in the UI
|
| 214 |
+
hide_log = false
|
packages.txt
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# System packages required for MoneyPrinterTurbo on Huggingface Spaces
|
| 2 |
+
# Video processing dependencies
|
| 3 |
+
ffmpeg
|
| 4 |
+
libavcodec-extra
|
| 5 |
+
libavformat58
|
| 6 |
+
libavutil56
|
| 7 |
+
libswscale5
|
| 8 |
+
libswresample3
|
| 9 |
+
|
| 10 |
+
# Image processing
|
| 11 |
+
libgl1-mesa-glx
|
| 12 |
+
libglib2.0-0
|
| 13 |
+
libsm6
|
| 14 |
+
libxext6
|
| 15 |
+
libxrender-dev
|
| 16 |
+
libgomp1
|
| 17 |
+
|
| 18 |
+
# Audio processing
|
| 19 |
+
libasound2
|
| 20 |
+
pulseaudio
|
| 21 |
+
|
| 22 |
+
# Font support
|
| 23 |
+
fonts-liberation
|
| 24 |
+
fonts-dejavu-core
|
| 25 |
+
fontconfig
|
| 26 |
+
|
| 27 |
+
# Additional utilities
|
| 28 |
+
wget
|
| 29 |
+
curl
|
| 30 |
+
unzip
|
requirements_hf.txt
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MoneyPrinterTurbo - Huggingface Spaces Dependencies
|
| 2 |
+
# Optimized for FREE tier deployment
|
| 3 |
+
|
| 4 |
+
# Core Streamlit
|
| 5 |
+
streamlit>=1.28.0
|
| 6 |
+
streamlit-option-menu>=0.3.6
|
| 7 |
+
|
| 8 |
+
# Configuration
|
| 9 |
+
toml>=0.10.0
|
| 10 |
+
|
| 11 |
+
# Logging
|
| 12 |
+
loguru>=0.7.0
|
| 13 |
+
|
| 14 |
+
# AI/LLM Libraries
|
| 15 |
+
openai>=1.0.0
|
| 16 |
+
requests>=2.31.0
|
| 17 |
+
|
| 18 |
+
# Video Processing (lightweight)
|
| 19 |
+
pillow>=10.0.0
|
| 20 |
+
moviepy>=1.0.3
|
| 21 |
+
|
| 22 |
+
# Audio Processing
|
| 23 |
+
pydub>=0.25.1
|
| 24 |
+
|
| 25 |
+
# Data Handling
|
| 26 |
+
pandas>=2.0.0
|
| 27 |
+
numpy>=1.24.0
|
| 28 |
+
|
| 29 |
+
# HTTP Client
|
| 30 |
+
httpx>=0.24.0
|
| 31 |
+
|
| 32 |
+
# Image Processing
|
| 33 |
+
opencv-python-headless>=4.8.0
|
| 34 |
+
|
| 35 |
+
# Compatibility fixes
|
| 36 |
+
protobuf<=3.20.3
|
| 37 |
+
|
| 38 |
+
# File handling
|
| 39 |
+
pathlib2>=2.3.7
|
| 40 |
+
|
| 41 |
+
# JSON handling
|
| 42 |
+
jsonschema>=4.17.0
|
| 43 |
+
|
| 44 |
+
# Time utilities
|
| 45 |
+
python-dateutil>=2.8.2
|
| 46 |
+
|
| 47 |
+
# UUID utilities
|
| 48 |
+
uuid>=1.30
|
| 49 |
+
|
| 50 |
+
# System utilities
|
| 51 |
+
psutil>=5.9.0
|
streamlit_app.py
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
MoneyPrinterTurbo - 简化版Streamlit应用
|
| 4 |
+
一键启动,无需复杂配置
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import os
|
| 8 |
+
import sys
|
| 9 |
+
import subprocess
|
| 10 |
+
from pathlib import Path
|
| 11 |
+
|
| 12 |
+
# 修复protobuf兼容性问题
|
| 13 |
+
os.environ["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"] = "python"
|
| 14 |
+
|
| 15 |
+
# 添加项目根目录到Python路径
|
| 16 |
+
project_root = Path(__file__).parent
|
| 17 |
+
sys.path.insert(0, str(project_root))
|
| 18 |
+
|
| 19 |
+
def check_dependencies():
|
| 20 |
+
"""检查基础依赖是否安装"""
|
| 21 |
+
required_packages = ['streamlit', 'toml', 'loguru']
|
| 22 |
+
missing_packages = []
|
| 23 |
+
|
| 24 |
+
for package in required_packages:
|
| 25 |
+
try:
|
| 26 |
+
__import__(package)
|
| 27 |
+
print(f"✅ {package} 已安装")
|
| 28 |
+
except ImportError:
|
| 29 |
+
missing_packages.append(package)
|
| 30 |
+
print(f"❌ {package} 缺失")
|
| 31 |
+
|
| 32 |
+
if missing_packages:
|
| 33 |
+
print(f"\n🔧 需要安装: {', '.join(missing_packages)}")
|
| 34 |
+
print("自动安装中...")
|
| 35 |
+
try:
|
| 36 |
+
subprocess.run([
|
| 37 |
+
sys.executable, "-m", "pip", "install",
|
| 38 |
+
*missing_packages, "protobuf==3.20.3"
|
| 39 |
+
], check=True, capture_output=True)
|
| 40 |
+
print("✅ 依赖安装完成")
|
| 41 |
+
return True
|
| 42 |
+
except subprocess.CalledProcessError:
|
| 43 |
+
print("❌ 自动安装失败,请手动运行:")
|
| 44 |
+
print(f"pip install {' '.join(missing_packages)} protobuf==3.20.3")
|
| 45 |
+
return False
|
| 46 |
+
return True
|
| 47 |
+
|
| 48 |
+
def setup_directories():
|
| 49 |
+
"""创建必要的目录"""
|
| 50 |
+
dirs = [
|
| 51 |
+
"storage/tasks",
|
| 52 |
+
"storage/temp",
|
| 53 |
+
"storage/cache_videos"
|
| 54 |
+
]
|
| 55 |
+
for dir_path in dirs:
|
| 56 |
+
os.makedirs(dir_path, exist_ok=True)
|
| 57 |
+
print(f"📁 创建目录: {dir_path}")
|
| 58 |
+
|
| 59 |
+
def find_streamlit_file():
|
| 60 |
+
"""查找可用的Streamlit文件"""
|
| 61 |
+
candidates = [
|
| 62 |
+
("webui/SimpleMain.py", "📱 简化版界面"),
|
| 63 |
+
("webui/Main.py", "🖥️ 完整版界面"),
|
| 64 |
+
("app.py", "☁️ HF Spaces版界面")
|
| 65 |
+
]
|
| 66 |
+
|
| 67 |
+
for file_path, description in candidates:
|
| 68 |
+
full_path = project_root / file_path
|
| 69 |
+
if full_path.exists():
|
| 70 |
+
print(f"找到界面文件: {description}")
|
| 71 |
+
return full_path
|
| 72 |
+
|
| 73 |
+
print("❌ 未找到任何界面文件")
|
| 74 |
+
return None
|
| 75 |
+
|
| 76 |
+
def main():
|
| 77 |
+
"""主启动函数"""
|
| 78 |
+
print("🚀 MoneyPrinterTurbo 简化启动器")
|
| 79 |
+
print("=" * 50)
|
| 80 |
+
|
| 81 |
+
# 检查依赖
|
| 82 |
+
print("📦 检查依赖...")
|
| 83 |
+
if not check_dependencies():
|
| 84 |
+
input("按回车键退出...")
|
| 85 |
+
return
|
| 86 |
+
|
| 87 |
+
# 创建目录
|
| 88 |
+
print("\n📁 设置目录...")
|
| 89 |
+
setup_directories()
|
| 90 |
+
|
| 91 |
+
# 查找界面文件
|
| 92 |
+
print("\n🔍 查找界面文件...")
|
| 93 |
+
target_file = find_streamlit_file()
|
| 94 |
+
if not target_file:
|
| 95 |
+
input("按回车键退出...")
|
| 96 |
+
return
|
| 97 |
+
|
| 98 |
+
# 启动Streamlit
|
| 99 |
+
print(f"\n🌐 启动Streamlit...")
|
| 100 |
+
print(f"📍 访问地址: http://localhost:8501")
|
| 101 |
+
print("=" * 50)
|
| 102 |
+
|
| 103 |
+
cmd = [
|
| 104 |
+
sys.executable, "-m", "streamlit", "run", str(target_file),
|
| 105 |
+
"--server.port=8501",
|
| 106 |
+
"--server.address=localhost",
|
| 107 |
+
"--browser.gatherUsageStats=false",
|
| 108 |
+
"--server.enableCORS=true",
|
| 109 |
+
"--theme.base=light"
|
| 110 |
+
]
|
| 111 |
+
|
| 112 |
+
try:
|
| 113 |
+
subprocess.run(cmd, check=True)
|
| 114 |
+
except KeyboardInterrupt:
|
| 115 |
+
print("\n👋 应用已停止")
|
| 116 |
+
except FileNotFoundError:
|
| 117 |
+
print("❌ Streamlit未安装,请运行: pip install streamlit")
|
| 118 |
+
except Exception as e:
|
| 119 |
+
print(f"❌ 启动失败: {e}")
|
| 120 |
+
print("💡 尝试手动运行: streamlit run webui/Main.py")
|
| 121 |
+
|
| 122 |
+
input("按回车键退出...")
|
| 123 |
+
|
| 124 |
+
if __name__ == "__main__":
|
| 125 |
+
main()
|