You can setup your ImGui program to only render new frames when there are new input events or your UI changes, but that’s not what the AI generated.
As it is now, it will max out one CPU core at 100% redrawing the same frames since glfwPollEvents() was used in the main loop.