From 013085da7dbbcb9641b602656f0a5cdf8e4989c1 Mon Sep 17 00:00:00 2001 From: qazal <77887910+Qazalin@users.noreply.github.com> Date: Mon, 30 Jun 2025 19:10:33 +0300 Subject: [PATCH] viz: only path "/" serves the UI (#11037) The dict used to exist for /profiler and main localhost:8000, we don't need it anymore. --- tinygrad/viz/serve.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tinygrad/viz/serve.py b/tinygrad/viz/serve.py index a8d8c28aed..8be1a8782d 100755 --- a/tinygrad/viz/serve.py +++ b/tinygrad/viz/serve.py @@ -168,8 +168,8 @@ class Handler(BaseHTTPRequestHandler): def do_GET(self): ret, status_code, content_type = b"", 200, "text/html" - if (fn:={"/":"index"}.get((url:=urlparse(self.path)).path)): - with open(os.path.join(os.path.dirname(__file__), f"{fn}.html"), "rb") as f: ret = f.read() + if (url:=urlparse(self.path)).path == "/": + with open(os.path.join(os.path.dirname(__file__), "index.html"), "rb") as f: ret = f.read() elif self.path.startswith(("/assets/", "/js/")) and '/..' not in self.path: try: with open(os.path.join(os.path.dirname(__file__), self.path.strip('/')), "rb") as f: ret = f.read()