From ab4ab4e595e89d1a9a39db70539d5944fdbe47fa Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Mon, 8 May 2023 15:23:49 +0300 Subject: add version to infotext, footer and console output when starting --- launch.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'launch.py') diff --git a/launch.py b/launch.py index 1dc12dae..2a33adc8 100644 --- a/launch.py +++ b/launch.py @@ -19,6 +19,7 @@ python = sys.executable git = os.environ.get('GIT', "git") index_url = os.environ.get('INDEX_URL', "") stored_commit_hash = None +stored_git_tag = None dir_repos = "repositories" if 'GRADIO_ANALYTICS_ENABLED' not in os.environ: @@ -70,6 +71,20 @@ def commit_hash(): return stored_commit_hash +def git_tag(): + global stored_git_tag + + if stored_git_tag is not None: + return stored_git_tag + + try: + stored_git_tag = run(f"{git} describe --tags").strip() + except Exception: + stored_git_tag = "" + + return stored_git_tag + + def run(command, desc=None, errdesc=None, custom_env=None, live=False): if desc is not None: print(desc) @@ -246,8 +261,10 @@ def prepare_environment(): check_python_version() commit = commit_hash() + tag = git_tag() print(f"Python {sys.version}") + print(f"Version: {tag}") print(f"Commit hash: {commit}") if args.reinstall_torch or not is_installed("torch") or not is_installed("torchvision"): -- cgit v1.2.3