Spaces:
Runtime error
Runtime error
Commit
·
ae8d4fa
1
Parent(s):
82c7068
Update app.py
Browse files
app.py
CHANGED
@@ -30,7 +30,7 @@ def replay(model_id, filename, environment, evaluate):
|
|
30 |
eval_env = VecFrameStack(eval_env, n_stack=4)
|
31 |
|
32 |
video_folder = 'logs/videos/'
|
33 |
-
video_length =
|
34 |
|
35 |
|
36 |
# Record the video starting at the first step
|
@@ -45,16 +45,16 @@ def replay(model_id, filename, environment, evaluate):
|
|
45 |
# Save the video
|
46 |
env.close()
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
results =
|
51 |
print(type(results))
|
52 |
print(env)
|
53 |
print(env.video_recorder.path)
|
54 |
|
55 |
videoclip = VideoFileClip(env.video_recorder.path)
|
56 |
videoclip.write_videofile("new_filename.mp4")
|
57 |
-
return 'new_filename.mp4'
|
58 |
|
59 |
|
60 |
|
@@ -66,5 +66,5 @@ iface = gr.Interface(fn=replay, inputs=[
|
|
66 |
]
|
67 |
|
68 |
|
69 |
-
, outputs="video")
|
70 |
iface.launch()
|
|
|
30 |
eval_env = VecFrameStack(eval_env, n_stack=4)
|
31 |
|
32 |
video_folder = 'logs/videos/'
|
33 |
+
video_length = 1000
|
34 |
|
35 |
|
36 |
# Record the video starting at the first step
|
|
|
45 |
# Save the video
|
46 |
env.close()
|
47 |
|
48 |
+
mean_reward, std_reward = evaluate_policy(model, env, n_eval_episodes=10)
|
49 |
+
print(f"mean_reward={mean_reward:.2f} +/- {std_reward}")
|
50 |
+
results = f"mean_reward={mean_reward:.2f} +/- {std_reward}"
|
51 |
print(type(results))
|
52 |
print(env)
|
53 |
print(env.video_recorder.path)
|
54 |
|
55 |
videoclip = VideoFileClip(env.video_recorder.path)
|
56 |
videoclip.write_videofile("new_filename.mp4")
|
57 |
+
return 'new_filename.mp4', results
|
58 |
|
59 |
|
60 |
|
|
|
66 |
]
|
67 |
|
68 |
|
69 |
+
, outputs=["video", "text"])
|
70 |
iface.launch()
|