diff --git a/MANIFEST.in b/MANIFEST.in index fd381a6..67ae514 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,2 @@ -include mujoco-maze/static/index.html \ No newline at end of file +include mujoco-maze/static/favicon.ico +include mujoco-maze/templates/index.html \ No newline at end of file diff --git a/mujoco_maze/maze_env.py b/mujoco_maze/maze_env.py index 2542f67..7e7a68f 100644 --- a/mujoco_maze/maze_env.py +++ b/mujoco_maze/maze_env.py @@ -370,7 +370,6 @@ class MazeEnv(gym.Env): super().__init__() self.pipe = pipe self.port = port - self.server = None def _run_server(self) -> None: import asyncio @@ -384,6 +383,7 @@ class MazeEnv(gym.Env): app = fastapi.FastAPI() html_path = pathlib.Path(__file__).parent.joinpath("static/index.html") html = html_path.read_text().replace("{{port}}", str(self.port)) + server = None @app.get("/") async def get(): @@ -403,11 +403,11 @@ class MazeEnv(gym.Env): res = stream.getvalue() await websocket.send_bytes(res) await websocket.close() - await self.server.shutdown() + server.should_exit = True config = uvicorn.Config(app, port=self.port) - self.server = uvicorn.Server(config) - self.server.run() + server = uvicorn.Server(config) + server.run() def run(self) -> None: try: diff --git a/mujoco_maze/static/favicon.ico b/mujoco_maze/static/favicon.ico new file mode 100644 index 0000000..45acf83 Binary files /dev/null and b/mujoco_maze/static/favicon.ico differ