Upload code/build_single.py with huggingface_hub
Browse files12345678910111213"""把 demo 打包成单文件 HTML(内联 CSS/JS/数据)。"""import pathlib
base = pathlib.Path(__file__).parenthtml = (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")code/build_single.pyAdded+13