Spaces:
Sleeping
Sleeping
| // 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"; | |
| })(); | |