File size: 965 Bytes
3b85727
317f6c1
3b85727
 
 
 
317f6c1
3b85727
4b87938
3b85727
7d44b16
3b85727
 
 
 
 
 
 
da15f1f
3b85727
 
 
 
 
 
 
 
 
 
 
 
 
 
e882d38
3b85727
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import gymnasium as gym

import streamlit as st
# import cv2
st.write(st.__version__ + "omg")
# env = gym.make("CartPole-v1", render_mode='rgb_array')

# observation, info = env.reset(seed=42)

# rgb_array = []

# for _ in range(1000):
#     action = env.action_space.sample()
#     observation, reward, terminated, truncated, info = env.step(action)
#     rgb_array.append(env.render())
#     if terminated or truncated:
#         observation, info = env.reset()
# env.close()

# fourcc = cv2.VideoWriter_fourcc(*'mp4v')
# out = cv2.VideoWriter('output.mp4', fourcc, 60.0, (rgb_array[0].shape[1], rgb_array[0].shape[0]))

# # Write each frame to the video
# for i in range(len(rgb_array)):
#     frame = rgb_array[i][:, :, ::-1] # Convert RGB to BGR
#     out.write(frame)

# # Release everything if job is finished
# out.release()

# video_file = open('.\output.mp4', 'rb')
# st.video(video_file.read())

with open("output.mp4", 'rb') as v:
    st.video(v.read())