Spaces:
Runtime error
Runtime error
Download trying.py from Energetic26/first-space: direct link, hf CLI and curl.
- Browser
- Download file 997 Bytes
-
https://huggingface.co/spaces/Energetic26/first-space/resolve/main/trying.py
- Command line
-
hf download hf://spaces/Energetic26/first-space/trying.py
-
curl -L -o trying.py https://huggingface.co/spaces/Energetic26/first-space/resolve/main/trying.py
997 Bytes
| # 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() | |