yuntian-deng commited on
Commit
d5db3f7
·
1 Parent(s): bc301c5

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -7
main.py CHANGED
@@ -106,8 +106,8 @@ def predict_next_frame(previous_frames: List[np.ndarray], previous_actions: List
106
  x, y = pos
107
  norm_x = int(round(x / 256 * 1024)) #x + (1920 - 256) / 2
108
  norm_y = int(round(y / 256 * 640)) #y + (1080 - 256) / 2
109
- norm_x = x
110
- norm_y = y
111
  action_descriptions.append(f"{(norm_x-prev_x):.0f}~{(norm_y-prev_y):.0f}")
112
  prev_x = norm_x
113
  prev_y = norm_y
@@ -140,7 +140,7 @@ async def websocket_endpoint(websocket: WebSocket):
140
  await websocket.accept()
141
  previous_frames = []
142
  previous_actions = []
143
- positions = ['496~61', '815~335', '815~335', '815~335', '787~342', '749~345', '749~345', '703~346', '703~346', '654~347', '604~349', '604~349', '555~353', '509~357', '509~357']
144
  try:
145
  while True:
146
  try:
@@ -155,10 +155,10 @@ async def websocket_endpoint(websocket: WebSocket):
155
  mouse_position = data.get("mouse_position")
156
 
157
  # Store the actions
158
- position = positions[0]
159
- positions = positions[1:]
160
- mouse_position = position.split('~')
161
- mouse_position = [int(item) for item in mouse_position]
162
  previous_actions.append((action_type, mouse_position))
163
 
164
  # Log the start time
 
106
  x, y = pos
107
  norm_x = int(round(x / 256 * 1024)) #x + (1920 - 256) / 2
108
  norm_y = int(round(y / 256 * 640)) #y + (1080 - 256) / 2
109
+ #norm_x = x
110
+ #norm_y = y
111
  action_descriptions.append(f"{(norm_x-prev_x):.0f}~{(norm_y-prev_y):.0f}")
112
  prev_x = norm_x
113
  prev_y = norm_y
 
140
  await websocket.accept()
141
  previous_frames = []
142
  previous_actions = []
143
+ #positions = ['496~61', '815~335', '815~335', '815~335', '787~342', '749~345', '749~345', '703~346', '703~346', '654~347', '604~349', '604~349', '555~353', '509~357', '509~357']
144
  try:
145
  while True:
146
  try:
 
155
  mouse_position = data.get("mouse_position")
156
 
157
  # Store the actions
158
+ #position = positions[0]
159
+ #positions = positions[1:]
160
+ #mouse_position = position.split('~')
161
+ #mouse_position = [int(item) for item in mouse_position]
162
  previous_actions.append((action_type, mouse_position))
163
 
164
  # Log the start time