Andrei Cozma commited on
Commit
e3af403
·
1 Parent(s): 4297e86
Files changed (2) hide show
  1. demo.py +7 -5
  2. run.py +1 -1
demo.py CHANGED
@@ -178,8 +178,8 @@ def run(policy_fname, n_test_episodes, max_steps, render_fps, epsilon):
178
  1.0,
179
  )
180
 
181
- # text_color = frame_policy[int((action + 0.5) * frame_policy_res // len(curr_policy)), frame_policy_h // 2]
182
- # text_color = 1.0 - text_color
183
 
184
  cv2.putText(
185
  frame_policy,
@@ -190,7 +190,7 @@ def run(policy_fname, n_test_episodes, max_steps, render_fps, epsilon):
190
  ),
191
  cv2.FONT_HERSHEY_SIMPLEX,
192
  0.8,
193
- 1.0,
194
  1,
195
  cv2.LINE_AA,
196
  )
@@ -210,7 +210,7 @@ def run(policy_fname, n_test_episodes, max_steps, render_fps, epsilon):
210
  ),
211
  cv2.FONT_HERSHEY_SIMPLEX,
212
  0.5,
213
- 1.0,
214
  1,
215
  cv2.LINE_AA,
216
  )
@@ -330,12 +330,14 @@ with gr.Blocks(title="CS581 Demo") as demo:
330
  minimum=0,
331
  maximum=1,
332
  value=live_epsilon,
 
333
  label="Epsilon (0 = greedy, 1 = random)",
334
  )
335
  input_epsilon.change(change_epsilon, inputs=[input_epsilon])
336
 
337
  input_render_fps = gr.components.Slider(
338
- minimum=1, maximum=60, value=live_render_fps, label="Simulation speed (fps)"
 
339
  )
340
  input_render_fps.change(change_render_fps, inputs=[input_render_fps])
341
 
 
178
  1.0,
179
  )
180
 
181
+ text_color = frame_policy[frame_policy_h // 2, int((action + 0.5) * frame_policy_res // len(curr_policy))]
182
+ text_color = 1.0 - text_color
183
 
184
  cv2.putText(
185
  frame_policy,
 
190
  ),
191
  cv2.FONT_HERSHEY_SIMPLEX,
192
  0.8,
193
+ text_color,
194
  1,
195
  cv2.LINE_AA,
196
  )
 
210
  ),
211
  cv2.FONT_HERSHEY_SIMPLEX,
212
  0.5,
213
+ text_color,
214
  1,
215
  cv2.LINE_AA,
216
  )
 
330
  minimum=0,
331
  maximum=1,
332
  value=live_epsilon,
333
+ step=1/200,
334
  label="Epsilon (0 = greedy, 1 = random)",
335
  )
336
  input_epsilon.change(change_epsilon, inputs=[input_epsilon])
337
 
338
  input_render_fps = gr.components.Slider(
339
+ minimum=1, maximum=60, value=live_render_fps, step=1,
340
+ label="Simulation speed (fps)"
341
  )
342
  input_render_fps.change(change_render_fps, inputs=[input_render_fps])
343
 
run.py CHANGED
@@ -48,7 +48,7 @@ def main():
48
  type=str,
49
  choices=["first_visit", "every_visit"],
50
  default="first_visit",
51
- help="The type of update to use. (default: first_visit)",
52
  )
53
 
54
  parser.add_argument(
 
48
  type=str,
49
  choices=["first_visit", "every_visit"],
50
  default="first_visit",
51
+ help="The type of update to use. Only supported by Monte-Carlo agent. (default: first_visit)",
52
  )
53
 
54
  parser.add_argument(