wing / sync_from_website.py
Jam1e3's picture
Mirror WING project page
0d64a56 verified
Raw History Blame Contribute Delete
881 Bytes
"""Mirror the WING project page into this static Space.
The page code is copied verbatim apart from asset URLs. Media stays on the
existing project website, so the Space does not duplicate large video files.
"""
from pathlib import Path
SPACE_DIR = Path(__file__).resolve().parent
WEBSITE_DIR = SPACE_DIR.parent
WEBSITE_URL = "https://mikuz12.github.io/wing/"
SOURCE_FILES = ("index.html", "styles.css", "script.js", "experiments.js")
ASSET_PREFIXES = ("assets/", "gen/", "main.pdf", "teaser.pdf", "wing_logo.png")
def main() -> None:
for name in SOURCE_FILES:
content = (WEBSITE_DIR / name).read_text(encoding="utf-8")
for prefix in ASSET_PREFIXES:
content = content.replace(prefix, WEBSITE_URL + prefix)
(SPACE_DIR / name).write_text(content, encoding="utf-8")
print(f"Synced {name}")
if __name__ == "__main__":
main()