// Where the live-inference API lives. // // Chapters 3–32 are pure client-side and never touch this. Only Chapter 1 // (tokenizer) and Chapter 2 (embeddings) call a Python+PyTorch backend for // real next-token predictions and embedding neighbours. // // • Served locally (python src/serve.py) → same origin, use a relative path. // • Served from the public site (amouaihub.com) → call the Hugging Face Space. // • Opened directly on the Space itself → same origin again. // // One file, both deployments: the hostname decides. (function () { var h = location.hostname; var isLocal = h === "" || h === "localhost" || h === "127.0.0.1" || h === "0.0.0.0"; // The Space serves this exact file too; on it, hostname ends in .hf.space, so // a relative path keeps it same-origin. var isSpace = /\.hf\.space$/.test(h); window.LMP_API = (isLocal || isSpace) ? "" : "https://aminamou-lm-playground-api.hf.space"; })();