Download code/build_single.py from eduzrh/helloworld: direct link, hf CLI and curl.
- Browser
- Download file 537 Bytes
-
https://huggingface.co/datasets/eduzrh/helloworld/resolve/main/code/build_single.py
- Command line
-
hf download hf://datasets/eduzrh/helloworld/code/build_single.py
-
curl -L -o build_single.py https://huggingface.co/datasets/eduzrh/helloworld/resolve/main/code/build_single.py
537 Bytes
| """把 demo 打包成单文件 HTML(内联 CSS/JS/数据)。""" | |
| import pathlib | |
| base = pathlib.Path(__file__).parent | |
| html = (base / "demo/index.html").read_text() | |
| app = (base / "demo/app.js").read_text() | |
| data = (base / "demo/data.js").read_text() | |
| html = html.replace('<script src="data.js"></script>', "<script>\n" + data + "\n</script>") | |
| html = html.replace('<script src="app.js"></script>', "<script>\n" + app + "\n</script>") | |
| out = base / "demo/cdhe-monitor.html" | |
| out.write_text(html) | |
| print(out, round(len(html) / 1e6, 2), "MB") | |