Energetic26 commited on
Commit
cdca0f4
·
1 Parent(s): ed53979

cartpole basic

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gym
2
+ import streamlit as st
3
+ import numpy as np
4
+
5
+ env = gym.make('CartPole-v1')
6
+
7
+ observation = env.reset()
8
+
9
+ while True:
10
+ image = env.render(mode='rgb_array')
11
+ st.image(image, caption='CartPole-v1', use_column_width=True)
12
+
13
+ action = env.action_space.sample()
14
+ observation, reward, done, info = env.step(action)
15
+
16
+ if done:
17
+ break