ThomasSimonini HF staff commited on
Commit
c044350
1 Parent(s): 4a80994

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -42,6 +42,11 @@ def replay(model_id, filename, environment, evaluate):
42
  obs, rewards, dones, info = env.step(action)
43
  # Save the video
44
  env.close()
 
 
 
 
 
45
 
46
 
47
  iface = gr.Interface(fn=replay, inputs=[
@@ -52,5 +57,5 @@ iface = gr.Interface(fn=replay, inputs=[
52
  ]
53
 
54
 
55
- , outputs="video")
56
  iface.launch()
 
42
  obs, rewards, dones, info = env.step(action)
43
  # Save the video
44
  env.close()
45
+
46
+ mean_reward, std_reward = evaluate_policy(model, env, n_eval_episodes=10)
47
+ print(f"mean_reward={mean_reward:.2f} +/- {std_reward}")
48
+
49
+ return f"mean_reward={mean_reward:.2f} +/- {std_reward}", "video"
50
 
51
 
52
  iface = gr.Interface(fn=replay, inputs=[
 
57
  ]
58
 
59
 
60
+ , outputs=["text", "video"])
61
  iface.launch()