# import gym # from IPython import display # import matplotlib.pyplot as plt # # %matplotlib inline # env = gym.make('Breakout-v0') # env.reset() # for _ in range(100): # plt.imshow(env.render(mode='rgb_array')) # display.display(plt.gcf()) # display.clear_output(wait=True) # action = env.action_space.sample() # env.step(action) import streamlit as st import numpy as np import matplotlib.pyplot as plt import time import gym # env = gym.make('CartPole-v1') # obs = env.reset() # while True: # action = env.action_space.sample() # obs, reward, done, info = env.step(action) # rgb_array = env.render(mode='rgb_array') # plt.imshow(env.render(mode='rgb_array')) # # use the RGB array for further processing or display # if done: # break # Create plot x = np.linspace(0, 10, 100) y = np.cos(x) fig, ax = plt.subplots() ax.plot(x, y) ax.set_title("Cosine wave") container = st.empty() container.pyplot(fig) time.sleep(10) container.empty()