diff --git a/web/app.py b/web/app.py index f1e5550..c37347e 100644 --- a/web/app.py +++ b/web/app.py @@ -29,6 +29,7 @@ if str(_project_root) not in sys.path: import asyncio import base64 import os +import tomllib import streamlit as st from loguru import logger @@ -56,6 +57,19 @@ def run_async(coro): return asyncio.run(coro) +def get_project_version(): + """Get project version from pyproject.toml""" + try: + pyproject_path = _project_root / "pyproject.toml" + if pyproject_path.exists(): + with open(pyproject_path, "rb") as f: + pyproject_data = tomllib.load(f) + return pyproject_data.get("project", {}).get("version", "Unknown") + except Exception as e: + logger.warning(f"Failed to read version from pyproject.toml: {e}") + return "Unknown" + + def safe_rerun(): """Safe rerun that works with both old and new Streamlit versions""" if hasattr(st, 'rerun'): @@ -458,6 +472,26 @@ def main(): # Use full filename for bgm_path (including extension) bgm_path = None if bgm_choice == tr("bgm.none") else bgm_choice + + # ==================================================================== + # Version Info & GitHub Section + # ==================================================================== + with st.container(border=True): + st.markdown(f"**{tr('version.title')}**") + version = get_project_version() + github_url = "https://github.com/AIDC-AI/Pixelle-Video" + + # Version and GitHub link in one line + github_url = "https://github.com/AIDC-AI/Pixelle-Video" + badge_url = "https://img.shields.io/github/stars/AIDC-AI/Pixelle-Video" + + st.markdown( + f'{tr("version.current")}: `{version}`    ' + f'' + f'GitHub stars' + f'', + unsafe_allow_html=True) + # ======================================================================== # Middle Column: TTS, Image Settings & Template diff --git a/web/i18n/locales/en_US.json b/web/i18n/locales/en_US.json index f554d11..d01155c 100644 --- a/web/i18n/locales/en_US.json +++ b/web/i18n/locales/en_US.json @@ -256,7 +256,12 @@ "help.how": "Customization", "help.note": "Note", - "language.select": "🌐 Language" + "language.select": "🌐 Language", + + "version.title": "📦 Version Info", + "version.current": "Current Version", + + "github.title": "⭐ Open Source Support" } } diff --git a/web/i18n/locales/zh_CN.json b/web/i18n/locales/zh_CN.json index 773eed0..12d5514 100644 --- a/web/i18n/locales/zh_CN.json +++ b/web/i18n/locales/zh_CN.json @@ -256,7 +256,12 @@ "help.how": "自定义方式", "help.note": "注意", - "language.select": "🌐 语言" + "language.select": "🌐 语言", + + "version.title": "📦 版本信息", + "version.current": "当前版本", + + "github.title": "⭐ 开源支持" } }