File size: 851 Bytes
88c6356 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import hashlib, io, os
from huggingface_hub import HfApi, hf_hub_download
REPO = "luispoveda93/pcap-kev-triage"
api = HfApi()
p = hf_hub_download(REPO, "app.py", repo_type="space", force_download=True)
src = open(p, encoding="utf-8").read()
pairs = [
("\U0001F3AF Playground", "\U0001F3AF Try"), # tab label + panel heading, emoji kept for meaning
]
total = 0
for old, new in pairs:
n = src.count(old)
assert n >= 1, f"pattern not found: {old!r}"
src = src.replace(old, new)
total += n
buf = io.BytesIO(src.encode("utf-8"))
sha = hashlib.sha256(buf.getvalue()).hexdigest()
api.upload_file(
path_or_fileobj=buf,
path_in_repo="app.py",
repo_id=REPO,
repo_type="space",
commit_message="ui: shorten Playground tab label so all tabs fit 390px mobile",
)
print(f"PATCH_OK replacements={total} sha256={sha}") |