Hi all, just wondering if anyone here has experience integrating OpenAI Gym environments with Streamlit, specifically for visualizing/interacting with the environments.
Hi @Brian,
I am not sure of the example you are referring to. I looked at some of the OpenAI Gym example and I could not get the animation to work in Streamlit. It seems OpenAI Gym opens a custom window and renders inside the window and, as far as I know, we don’t support that.
I tried:
import gym
env = gym.make('CartPole-v0')
env.reset()
for _ in range(1000):
env.render()
env.step(env.action_space.sample()) # take a random action
env.close()
A possibility could be to change env.render() into something that uses a Streamlit primitive. I think it is what render_text_game in the example you posted is doing. I can see if I can get a hold of the code.