Andrei Cozma commited on
Commit
fee7b36
·
1 Parent(s): a5e34df
Files changed (1) hide show
  1. demo.py +11 -6
demo.py CHANGED
@@ -92,31 +92,31 @@ def reset_click(state):
92
 
93
 
94
  def change_render_fps(state, x):
95
- print("Changing render fps:", x)
96
  state.live_render_fps = x
97
  return state
98
 
99
 
100
  def change_render_fps_update(state, x):
101
- print("Changing render fps:", x)
102
  state.live_render_fps = x
103
  return state, gr.update(value=x)
104
 
105
 
106
  def change_epsilon(state, x):
107
- print("Changing greediness:", x)
108
  state.live_epsilon = x
109
  return state
110
 
111
 
112
  def change_epsilon_update(state, x):
113
- print("Changing greediness:", x)
114
  state.live_epsilon = x
115
  return state, gr.update(value=x)
116
 
117
 
118
  def change_paused(state, x):
119
- print("Changing paused:", x)
120
  state.live_paused = pause_val_map[x]
121
  return (
122
  state,
@@ -218,7 +218,12 @@ def run(
218
  (action + 0.5) * frame_policy_res // len(curr_policy)
219
  )
220
 
221
- frame_policy_label_color = 1.0 - frame_policy[label_loc_h, label_loc_w]
 
 
 
 
 
222
  frame_policy_label_font = cv2.FONT_HERSHEY_SIMPLEX
223
  frame_policy_label_thicc = 1
224
  action_text_scale, action_text_label_scale = 1.0, 0.6
 
92
 
93
 
94
  def change_render_fps(state, x):
95
+ print("change_render_fps:", x)
96
  state.live_render_fps = x
97
  return state
98
 
99
 
100
  def change_render_fps_update(state, x):
101
+ print("change_render_fps:", x)
102
  state.live_render_fps = x
103
  return state, gr.update(value=x)
104
 
105
 
106
  def change_epsilon(state, x):
107
+ print("change_epsilon:", x)
108
  state.live_epsilon = x
109
  return state
110
 
111
 
112
  def change_epsilon_update(state, x):
113
+ print("change_epsilon:", x)
114
  state.live_epsilon = x
115
  return state, gr.update(value=x)
116
 
117
 
118
  def change_paused(state, x):
119
+ print("change_paused:", x)
120
  state.live_paused = pause_val_map[x]
121
  return (
122
  state,
 
218
  (action + 0.5) * frame_policy_res // len(curr_policy)
219
  )
220
 
221
+ frame_policy_label_color = 0.0
222
+ if frame_policy[label_loc_h, label_loc_w] > 0.5:
223
+ frame_policy_label_color = 0.0
224
+ else:
225
+ frame_policy_label_color = 1.0
226
+
227
  frame_policy_label_font = cv2.FONT_HERSHEY_SIMPLEX
228
  frame_policy_label_thicc = 1
229
  action_text_scale, action_text_label_scale = 1.0, 0.6