yuntian-deng commited on
Commit
aca606e
·
1 Parent(s): 704eccb

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +8 -1
main.py CHANGED
@@ -59,15 +59,22 @@ def predict_next_frame(previous_frames: List[np.ndarray], previous_actions: List
59
  #action_descriptions = [f"{pos[0]}:{pos[1]}" for _, pos in previous_actions[-7:]]
60
  #prompt = " ".join(action_descriptions)
61
  action_descriptions = []
 
 
 
 
62
  for action_type, pos in previous_actions[-7:]:
63
  if action_type == "move":
64
- action_descriptions.append(f"{pos[0]}:{pos[1]}")
 
 
65
  elif action_type == "left_click":
66
  action_descriptions.append("left_click")
67
  elif action_type == "right_click":
68
  action_descriptions.append("right_click")
69
 
70
  prompt = " ".join(action_descriptions)
 
71
 
72
  # Generate the next frame
73
  new_frame = sample_frame(model, prompt, image_sequence_tensor)
 
59
  #action_descriptions = [f"{pos[0]}:{pos[1]}" for _, pos in previous_actions[-7:]]
60
  #prompt = " ".join(action_descriptions)
61
  action_descriptions = []
62
+ def norm_x(x):
63
+ return x + (1920 - 256) / 2
64
+ def norm_y(y):
65
+ return y + (1080 - 256) / 2
66
  for action_type, pos in previous_actions[-7:]:
67
  if action_type == "move":
68
+ print (pos[0], pos[1])
69
+ action_descriptions.append(f"{norm_x(pos[0])}:{norm_y(pos[1])}")
70
+
71
  elif action_type == "left_click":
72
  action_descriptions.append("left_click")
73
  elif action_type == "right_click":
74
  action_descriptions.append("right_click")
75
 
76
  prompt = " ".join(action_descriptions)
77
+ print (prompt)
78
 
79
  # Generate the next frame
80
  new_frame = sample_frame(model, prompt, image_sequence_tensor)