支持生成耗时统计

This commit is contained in:
puke
2025-11-07 15:48:08 +08:00
parent 9244a80363
commit 7d0de0c068
3 changed files with 10 additions and 1 deletions

View File

@@ -1072,6 +1072,10 @@ def main():
progress_bar = st.progress(0)
status_text = st.empty()
# Record start time for generation
import time
start_time = time.time()
try:
# Progress callback to update UI
def update_progress(event: ProgressEvent):
@@ -1137,6 +1141,9 @@ def main():
result = run_async(pixelle_video.generate_video(**video_params))
# Calculate total generation time
total_generation_time = time.time() - start_time
progress_bar.progress(100)
status_text.text(tr("status.success"))
@@ -1154,7 +1161,7 @@ def main():
video_width, video_height = parse_template_size(template_path)
info_text = (
f"⏱️ {result.duration:.1f}s "
f"⏱️ {tr('info.generation_time')} {total_generation_time:.1f}s "
f"📦 {file_size_mb:.2f}MB "
f"🎬 {len(result.storyboard.frames)}{tr('info.scenes_unit')} "
f"📐 {video_width}x{video_height}"

View File

@@ -160,6 +160,7 @@
"info.resolution": "Resolution",
"info.video_information": "📊 Video Information",
"info.no_video_yet": "Video preview will appear here after generation",
"info.generation_time": "Generation Time",
"settings.title": "⚙️ System Configuration (Required)",
"settings.not_configured": "⚠️ Please complete system configuration before generating videos",

View File

@@ -160,6 +160,7 @@
"info.resolution": "分辨率",
"info.video_information": "📊 视频信息",
"info.no_video_yet": "生成视频后,预览将显示在这里",
"info.generation_time": "生成耗时",
"settings.title": "⚙️ 系统配置(必需)",
"settings.not_configured": "⚠️ 请先完成系统配置才能生成视频",