region:us
# Reinforcement Learning with CartPole-v1


Run the model with the code below : 

```python
import gym
from stable_baselines3 import A2C

# Load
model = A2C.load("BE_RL_CartPole/a2c_cartpole")
env_human = gym.make("CartPole-v1",render_mode="human")
obs = env_human.reset()[0]
for i in range(1000):
    action, _states = model.predict(obs, deterministic=True)
    obs, rewards, dones, info, _ = env_human.step(action)
    env_human.render()

# Close
env_human.close()
```



---
license: mit
---
