Spaces:
Runtime error
Runtime error
Commit
·
3a00f55
1
Parent(s):
9c3c2d7
Update main.py
Browse files
main.py
CHANGED
|
@@ -102,13 +102,16 @@ def predict_next_frame(previous_frames: List[np.ndarray], previous_actions: List
|
|
| 102 |
previous_actions.insert(0, ("move", unnorm_coords(x, y)))
|
| 103 |
else:
|
| 104 |
break
|
| 105 |
-
|
|
|
|
| 106 |
for action_type, pos in previous_actions[-7:]:
|
| 107 |
if action_type == "move":
|
| 108 |
x, y = pos
|
| 109 |
norm_x = int(round(x / 256 * 1024)) #x + (1920 - 256) / 2
|
| 110 |
norm_y = int(round(y / 256 * 640)) #y + (1080 - 256) / 2
|
| 111 |
-
action_descriptions.append(f"{norm_x:.0f}~{norm_y:.0f}")
|
|
|
|
|
|
|
| 112 |
elif action_type == "left_click":
|
| 113 |
action_descriptions.append("left_click")
|
| 114 |
elif action_type == "right_click":
|
|
|
|
| 102 |
previous_actions.insert(0, ("move", unnorm_coords(x, y)))
|
| 103 |
else:
|
| 104 |
break
|
| 105 |
+
prev_x = 0
|
| 106 |
+
prev_y = 0
|
| 107 |
for action_type, pos in previous_actions[-7:]:
|
| 108 |
if action_type == "move":
|
| 109 |
x, y = pos
|
| 110 |
norm_x = int(round(x / 256 * 1024)) #x + (1920 - 256) / 2
|
| 111 |
norm_y = int(round(y / 256 * 640)) #y + (1080 - 256) / 2
|
| 112 |
+
action_descriptions.append(f"{(norm_x-prev_x):.0f}~{(norm_y-prev_y):.0f}")
|
| 113 |
+
prev_x = norm_x
|
| 114 |
+
prev_y = norm_y
|
| 115 |
elif action_type == "left_click":
|
| 116 |
action_descriptions.append("left_click")
|
| 117 |
elif action_type == "right_click":
|