diff --git a/mujoco_maze/static/index.html b/mujoco_maze/static/index.html deleted file mode 100644 index ed58d17..0000000 --- a/mujoco_maze/static/index.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - MuJoCo maze visualizer - - - -
- -
- - diff --git a/mujoco_maze/websock_viewer.py b/mujoco_maze/websock_viewer.py index 9dad232..07b82d0 100644 --- a/mujoco_maze/websock_viewer.py +++ b/mujoco_maze/websock_viewer.py @@ -1,13 +1,42 @@ import asyncio import io import multiprocessing as mp -import pathlib import fastapi import uvicorn from PIL import Image +HTML = """ + + + + MuJoCo maze visualizer + + + +
+ +
+ + +""" + class _ServerWorker(mp.Process): def __init__(self, pipe: mp.connection.Pipe, port: int) -> None: @@ -18,9 +47,7 @@ class _ServerWorker(mp.Process): def _run_server(self) -> None: app = fastapi.FastAPI() - static = pathlib.Path(__file__).parent.joinpath("static") - html_path = static.joinpath("index.html") - html = html_path.read_text().replace("{{port}}", str(self.port)) + html = HTML.replace("{{port}}", str(self.port)) @app.get("/") async def get():