Spaces:
Runtime error
Runtime error
Commit
•
167b87e
1
Parent(s):
add87d8
Update app.py
Browse files- Remove nb of episodes
app.py
CHANGED
@@ -32,13 +32,13 @@ def load_model(env_name):
|
|
32 |
|
33 |
return model
|
34 |
|
35 |
-
def replay(env_name, time_sleep
|
36 |
env = load_env(env_name)
|
37 |
model = load_model(env_name)
|
38 |
-
for i in range(num_episodes):
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
frame = env.render(mode="rgb_array")
|
43 |
action, _states = model.predict(obs)
|
44 |
obs, reward, done, info = env.step([action])
|
@@ -53,11 +53,11 @@ demo = gr.Interface(
|
|
53 |
"SeaquestNoFrameskip-v4",
|
54 |
"QbertNoFrameskip-v4",
|
55 |
]),
|
56 |
-
gr.Slider(0.01, 1, value=0.
|
57 |
-
gr.Slider(1, 20, value=5)
|
58 |
],
|
59 |
gr.Image(),
|
60 |
title="Watch Agents playing Atari games 🤖",
|
61 |
description="Select an environment to watch a Hugging Face's trained deep reinforcement learning agent.",
|
62 |
-
article = "time_sleep is the time delay between each frame (0.
|
63 |
-
).launch(
|
|
|
32 |
|
33 |
return model
|
34 |
|
35 |
+
def replay(env_name, time_sleep): #, num_episodes):
|
36 |
env = load_env(env_name)
|
37 |
model = load_model(env_name)
|
38 |
+
#for i in range(num_episodes):
|
39 |
+
obs = env.reset()
|
40 |
+
done = False
|
41 |
+
while not done:
|
42 |
frame = env.render(mode="rgb_array")
|
43 |
action, _states = model.predict(obs)
|
44 |
obs, reward, done, info = env.step([action])
|
|
|
53 |
"SeaquestNoFrameskip-v4",
|
54 |
"QbertNoFrameskip-v4",
|
55 |
]),
|
56 |
+
gr.Slider(0.01, 1, value=0.05),
|
57 |
+
#gr.Slider(1, 20, value=5)
|
58 |
],
|
59 |
gr.Image(),
|
60 |
title="Watch Agents playing Atari games 🤖",
|
61 |
description="Select an environment to watch a Hugging Face's trained deep reinforcement learning agent.",
|
62 |
+
article = "time_sleep is the time delay between each frame (0.05 by default)."
|
63 |
+
).launch().queue()
|