Spaces:
Runtime error
Runtime error
da03
commited on
Commit
·
1803da7
1
Parent(s):
c51c20d
main.py
CHANGED
@@ -131,7 +131,7 @@ def load_initial_images(width, height):
|
|
131 |
initial_images = []
|
132 |
if DEBUG_TEACHER_FORCING:
|
133 |
# Load the previous 7 frames for image_81
|
134 |
-
for i in range(
|
135 |
img = Image.open(f"record_10003/image_{i}.png").resize((width, height))
|
136 |
initial_images.append(np.array(img))
|
137 |
else:
|
@@ -400,7 +400,7 @@ async def websocket_endpoint(websocket: WebSocket):
|
|
400 |
positions = positions[1:]
|
401 |
x, y, action_type = parse_action_string(position)
|
402 |
mouse_position = (x, y)
|
403 |
-
if
|
404 |
previous_actions.append((action_type, mouse_position))
|
405 |
#previous_actions = [(action_type, mouse_position)]
|
406 |
|
@@ -409,13 +409,13 @@ async def websocket_endpoint(websocket: WebSocket):
|
|
409 |
|
410 |
# Predict the next frame based on the previous frames and actions
|
411 |
if DEBUG_TEACHER_FORCING:
|
412 |
-
print ('predicting', f"record_10003/image_{
|
413 |
|
414 |
next_frame, next_frame_append = predict_next_frame(previous_frames, previous_actions)
|
415 |
# Load and append the corresponding ground truth image instead of model output
|
416 |
print ('here4', len(previous_frames))
|
417 |
if True and DEBUG_TEACHER_FORCING:
|
418 |
-
img = Image.open(f"record_10003/image_{
|
419 |
previous_frames.append(img)
|
420 |
elif True:
|
421 |
previous_frames.append(next_frame_append)
|
|
|
131 |
initial_images = []
|
132 |
if DEBUG_TEACHER_FORCING:
|
133 |
# Load the previous 7 frames for image_81
|
134 |
+
for i in range(114-7, 114): # Load images 74-80
|
135 |
img = Image.open(f"record_10003/image_{i}.png").resize((width, height))
|
136 |
initial_images.append(np.array(img))
|
137 |
else:
|
|
|
400 |
positions = positions[1:]
|
401 |
x, y, action_type = parse_action_string(position)
|
402 |
mouse_position = (x, y)
|
403 |
+
if True:
|
404 |
previous_actions.append((action_type, mouse_position))
|
405 |
#previous_actions = [(action_type, mouse_position)]
|
406 |
|
|
|
409 |
|
410 |
# Predict the next frame based on the previous frames and actions
|
411 |
if DEBUG_TEACHER_FORCING:
|
412 |
+
print ('predicting', f"record_10003/image_{114+len(previous_frames)}.png")
|
413 |
|
414 |
next_frame, next_frame_append = predict_next_frame(previous_frames, previous_actions)
|
415 |
# Load and append the corresponding ground truth image instead of model output
|
416 |
print ('here4', len(previous_frames))
|
417 |
if True and DEBUG_TEACHER_FORCING:
|
418 |
+
img = Image.open(f"record_10003/image_{114+len(previous_frames)}.png")
|
419 |
previous_frames.append(img)
|
420 |
elif True:
|
421 |
previous_frames.append(next_frame_append)
|