add footer with versions
This commit is contained in:
parent
01a1fee874
commit
997461d3dd
4 changed files with 55 additions and 5 deletions
|
@ -7,3 +7,7 @@
|
|||
•
|
||||
<a href="/" onclick="javascript:gradioApp().getElementById('settings_restart_gradio').click(); return false">Reload UI</a>
|
||||
</div>
|
||||
<br />
|
||||
<div class="versions">
|
||||
{versions}
|
||||
</div>
|
||||
|
|
20
launch.py
20
launch.py
|
@ -13,6 +13,21 @@ dir_extensions = "extensions"
|
|||
python = sys.executable
|
||||
git = os.environ.get('GIT', "git")
|
||||
index_url = os.environ.get('INDEX_URL', "")
|
||||
stored_commit_hash = None
|
||||
|
||||
|
||||
def commit_hash():
|
||||
global stored_commit_hash
|
||||
|
||||
if stored_commit_hash is not None:
|
||||
return stored_commit_hash
|
||||
|
||||
try:
|
||||
stored_commit_hash = run(f"{git} rev-parse HEAD").strip()
|
||||
except Exception:
|
||||
stored_commit_hash = "<none>"
|
||||
|
||||
return stored_commit_hash
|
||||
|
||||
|
||||
def extract_arg(args, name):
|
||||
|
@ -194,10 +209,7 @@ def prepare_environment():
|
|||
xformers = '--xformers' in sys.argv
|
||||
ngrok = '--ngrok' in sys.argv
|
||||
|
||||
try:
|
||||
commit = run(f"{git} rev-parse HEAD").strip()
|
||||
except Exception:
|
||||
commit = "<none>"
|
||||
commit = commit_hash()
|
||||
|
||||
print(f"Python {sys.version}")
|
||||
print(f"Commit hash: {commit}")
|
||||
|
|
|
@ -1696,7 +1696,9 @@ def create_ui():
|
|||
|
||||
if os.path.exists("html/footer.html"):
|
||||
with open("html/footer.html", encoding="utf8") as file:
|
||||
gr.HTML(file.read(), elem_id="footer")
|
||||
footer = file.read()
|
||||
footer = footer.format(versions=versions_html())
|
||||
gr.HTML(footer, elem_id="footer")
|
||||
|
||||
text_settings = gr.Textbox(elem_id="settings_json", value=lambda: opts.dumpjson(), visible=False)
|
||||
settings_submit.click(
|
||||
|
@ -1857,3 +1859,30 @@ def reload_javascript():
|
|||
|
||||
if not hasattr(shared, 'GradioTemplateResponseOriginal'):
|
||||
shared.GradioTemplateResponseOriginal = gradio.routes.templates.TemplateResponse
|
||||
|
||||
|
||||
def versions_html():
|
||||
import torch
|
||||
import launch
|
||||
|
||||
python_version = ".".join([str(x) for x in sys.version_info[0:3]])
|
||||
commit = launch.commit_hash()
|
||||
short_commit = commit[0:8]
|
||||
|
||||
if shared.xformers_available:
|
||||
import xformers
|
||||
xformers_version = xformers.__version__
|
||||
else:
|
||||
xformers_version = "N/A"
|
||||
|
||||
return f"""
|
||||
python: <span title="{sys.version}">{python_version}</span>
|
||||
•
|
||||
torch: {torch.__version__}
|
||||
•
|
||||
xformers: {xformers_version}
|
||||
•
|
||||
gradio: {gr.__version__}
|
||||
•
|
||||
commit: <a href="https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/{commit}">{short_commit}</a>
|
||||
"""
|
||||
|
|
|
@ -628,6 +628,11 @@ footer {
|
|||
display: inline-block;
|
||||
}
|
||||
|
||||
#footer .versions{
|
||||
font-size: 85%;
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
/* The following handles localization for right-to-left (RTL) languages like Arabic.
|
||||
The rtl media type will only be activated by the logic in javascript/localization.js.
|
||||
If you change anything above, you need to make sure it is RTL compliant by just running
|
||||
|
|
Loading…
Reference in a new issue