添加版本信息支持
This commit is contained in:
34
web/app.py
34
web/app.py
@@ -29,6 +29,7 @@ if str(_project_root) not in sys.path:
|
|||||||
import asyncio
|
import asyncio
|
||||||
import base64
|
import base64
|
||||||
import os
|
import os
|
||||||
|
import tomllib
|
||||||
|
|
||||||
import streamlit as st
|
import streamlit as st
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
@@ -56,6 +57,19 @@ def run_async(coro):
|
|||||||
return asyncio.run(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():
|
def safe_rerun():
|
||||||
"""Safe rerun that works with both old and new Streamlit versions"""
|
"""Safe rerun that works with both old and new Streamlit versions"""
|
||||||
if hasattr(st, 'rerun'):
|
if hasattr(st, 'rerun'):
|
||||||
@@ -458,6 +472,26 @@ def main():
|
|||||||
|
|
||||||
# Use full filename for bgm_path (including extension)
|
# Use full filename for bgm_path (including extension)
|
||||||
bgm_path = None if bgm_choice == tr("bgm.none") else bgm_choice
|
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'<a href="{github_url}" target="_blank">'
|
||||||
|
f'<img src="{badge_url}" alt="GitHub stars" style="vertical-align: middle;">'
|
||||||
|
f'</a>',
|
||||||
|
unsafe_allow_html=True)
|
||||||
|
|
||||||
|
|
||||||
# ========================================================================
|
# ========================================================================
|
||||||
# Middle Column: TTS, Image Settings & Template
|
# Middle Column: TTS, Image Settings & Template
|
||||||
|
|||||||
@@ -256,7 +256,12 @@
|
|||||||
"help.how": "Customization",
|
"help.how": "Customization",
|
||||||
"help.note": "Note",
|
"help.note": "Note",
|
||||||
|
|
||||||
"language.select": "🌐 Language"
|
"language.select": "🌐 Language",
|
||||||
|
|
||||||
|
"version.title": "📦 Version Info",
|
||||||
|
"version.current": "Current Version",
|
||||||
|
|
||||||
|
"github.title": "⭐ Open Source Support"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -256,7 +256,12 @@
|
|||||||
"help.how": "自定义方式",
|
"help.how": "自定义方式",
|
||||||
"help.note": "注意",
|
"help.note": "注意",
|
||||||
|
|
||||||
"language.select": "🌐 语言"
|
"language.select": "🌐 语言",
|
||||||
|
|
||||||
|
"version.title": "📦 版本信息",
|
||||||
|
"version.current": "当前版本",
|
||||||
|
|
||||||
|
"github.title": "⭐ 开源支持"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user