Spaces:
Runtime error
Runtime error
da03
commited on
Commit
·
5845822
1
Parent(s):
242e406
- main.py +24 -8
- record_10003/image_10.png +3 -0
- record_10003/image_100.png +3 -0
- record_10003/image_101.png +3 -0
- record_10003/image_102.png +3 -0
- record_10003/image_103.png +3 -0
- record_10003/image_104.png +3 -0
- record_10003/image_105.png +3 -0
- record_10003/image_106.png +3 -0
- record_10003/image_107.png +3 -0
- record_10003/image_108.png +3 -0
- record_10003/image_109.png +3 -0
- record_10003/image_11.png +3 -0
- record_10003/image_110.png +3 -0
- record_10003/image_111.png +3 -0
- record_10003/image_112.png +3 -0
- record_10003/image_113.png +3 -0
- record_10003/image_114.png +3 -0
- record_10003/image_115.png +3 -0
- record_10003/image_116.png +3 -0
- record_10003/image_117.png +3 -0
- record_10003/image_118.png +3 -0
- record_10003/image_119.png +3 -0
- record_10003/image_12.png +3 -0
- record_10003/image_120.png +3 -0
- record_10003/image_121.png +3 -0
- record_10003/image_122.png +3 -0
- record_10003/image_123.png +3 -0
- record_10003/image_124.png +3 -0
- record_10003/image_125.png +3 -0
- record_10003/image_126.png +3 -0
- record_10003/image_127.png +3 -0
- record_10003/image_128.png +3 -0
- record_10003/image_129.png +3 -0
- record_10003/image_13.png +3 -0
- record_10003/image_130.png +3 -0
- record_10003/image_131.png +3 -0
- record_10003/image_132.png +3 -0
- record_10003/image_133.png +3 -0
- record_10003/image_134.png +3 -0
- record_10003/image_135.png +3 -0
- record_10003/image_136.png +3 -0
- record_10003/image_137.png +3 -0
- record_10003/image_138.png +3 -0
- record_10003/image_139.png +3 -0
main.py
CHANGED
@@ -13,7 +13,7 @@ import os
|
|
13 |
import time
|
14 |
|
15 |
DEBUG = False
|
16 |
-
DEBUG_TEACHER_FORCING =
|
17 |
app = FastAPI()
|
18 |
|
19 |
# Mount the static directory to serve HTML, JavaScript, and CSS files
|
@@ -333,6 +333,14 @@ async def websocket_endpoint(websocket: WebSocket):
|
|
333 |
'N + 1 1 9 7 : + 0 2 9 7', 'N + 1 1 9 7 : + 0 2 9 7',
|
334 |
'N + 1 1 9 7 : + 0 2 9 7'
|
335 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
previous_actions = []
|
337 |
for action in debug_actions[-8:]:
|
338 |
action = action.replace('1 1', '0 4')
|
@@ -356,6 +364,14 @@ async def websocket_endpoint(websocket: WebSocket):
|
|
356 |
'N + 0 9 0 5 : + 0 3 8 8', 'N + 0 8 6 8 : + 0 4 0 0',
|
357 |
'N + 0 8 3 2 : + 0 4 1 1'
|
358 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
359 |
#positions = positions[:4]
|
360 |
try:
|
361 |
while True:
|
@@ -379,31 +395,31 @@ async def websocket_endpoint(websocket: WebSocket):
|
|
379 |
#mouse_position = position.split('~')
|
380 |
#mouse_position = [int(item) for item in mouse_position]
|
381 |
#mouse_position = '+ 0 8 1 5 : + 0 3 3 5'
|
382 |
-
if
|
383 |
position = positions[0]
|
384 |
positions = positions[1:]
|
385 |
x, y, action_type = parse_action_string(position)
|
386 |
mouse_position = (x, y)
|
387 |
-
if
|
388 |
previous_actions.append((action_type, mouse_position))
|
389 |
-
previous_actions = [(action_type, mouse_position)]
|
390 |
|
391 |
# Log the start time
|
392 |
start_time = time.time()
|
393 |
|
394 |
# Predict the next frame based on the previous frames and actions
|
395 |
if DEBUG_TEACHER_FORCING:
|
396 |
-
print ('predicting', f"
|
397 |
|
398 |
next_frame, next_frame_append = predict_next_frame(previous_frames, previous_actions)
|
399 |
# Load and append the corresponding ground truth image instead of model output
|
400 |
print ('here4', len(previous_frames))
|
401 |
-
if
|
402 |
-
img = Image.open(f"
|
403 |
previous_frames.append(img)
|
404 |
elif True:
|
405 |
previous_frames.append(next_frame_append)
|
406 |
-
previous_frames = []
|
407 |
|
408 |
# Convert the numpy array to a base64 encoded image
|
409 |
img = Image.fromarray(next_frame)
|
|
|
13 |
import time
|
14 |
|
15 |
DEBUG = False
|
16 |
+
DEBUG_TEACHER_FORCING = True
|
17 |
app = FastAPI()
|
18 |
|
19 |
# Mount the static directory to serve HTML, JavaScript, and CSS files
|
|
|
333 |
'N + 1 1 9 7 : + 0 2 9 7', 'N + 1 1 9 7 : + 0 2 9 7',
|
334 |
'N + 1 1 9 7 : + 0 2 9 7'
|
335 |
]
|
336 |
+
debug_actions = ['N + 0 0 4 0 : + 0 2 0 4', 'N + 0 1 3 8 : + 0 1 9 0',
|
337 |
+
'N + 0 2 7 4 : + 0 3 8 3', 'N + 0 5 0 1 : + 0 1 7 3',
|
338 |
+
'L + 0 4 7 3 : + 0 0 8 7', 'N + 0 1 0 9 : + 0 3 4 4',
|
339 |
+
'N + 0 0 5 2 : + 0 1 9 4', 'N + 0 3 6 5 : + 0 2 3 2',
|
340 |
+
'N + 0 3 8 9 : + 0 2 4 5', 'N + 0 0 2 0 : + 0 0 5 9',
|
341 |
+
'N + 0 4 7 3 : + 0 1 5 7', 'L + 0 1 9 1 : + 0 0 8 7',
|
342 |
+
'L + 0 1 9 1 : + 0 0 8 7', 'N + 0 3 4 3 : + 0 2 6 3', ]
|
343 |
+
#'N + 0 2 0 5 : + 0 1 3 3']
|
344 |
previous_actions = []
|
345 |
for action in debug_actions[-8:]:
|
346 |
action = action.replace('1 1', '0 4')
|
|
|
364 |
'N + 0 9 0 5 : + 0 3 8 8', 'N + 0 8 6 8 : + 0 4 0 0',
|
365 |
'N + 0 8 3 2 : + 0 4 1 1'
|
366 |
]
|
367 |
+
positions = ['N + 0 2 0 5 : + 0 1 3 3', 'N + 0 0 7 6 : + 0 3 4 5',
|
368 |
+
'N + 0 3 1 8 : + 0 3 3 3', 'N + 0 2 5 4 : + 0 2 9 0',
|
369 |
+
'N + 0 1 0 6 : + 0 1 6 4', 'N + 0 0 7 4 : + 0 2 8 4',
|
370 |
+
'N + 0 0 2 4 : + 0 0 4 1', 'N + 0 1 5 0 : + 0 3 8 3',
|
371 |
+
'N + 0 4 0 5 : + 0 1 6 8', 'N + 0 0 5 4 : + 0 3 2 4',
|
372 |
+
'N + 0 2 9 0 : + 0 1 4 1', 'N + 0 4 0 2 : + 0 0 0 9',
|
373 |
+
'N + 0 3 0 7 : + 0 3 3 2', 'N + 0 2 2 0 : + 0 3 7 1',
|
374 |
+
'N + 0 0 8 2 : + 0 1 5 1']
|
375 |
#positions = positions[:4]
|
376 |
try:
|
377 |
while True:
|
|
|
395 |
#mouse_position = position.split('~')
|
396 |
#mouse_position = [int(item) for item in mouse_position]
|
397 |
#mouse_position = '+ 0 8 1 5 : + 0 3 3 5'
|
398 |
+
if True and DEBUG_TEACHER_FORCING:
|
399 |
position = positions[0]
|
400 |
positions = positions[1:]
|
401 |
x, y, action_type = parse_action_string(position)
|
402 |
mouse_position = (x, y)
|
403 |
+
if False:
|
404 |
previous_actions.append((action_type, mouse_position))
|
405 |
+
#previous_actions = [(action_type, mouse_position)]
|
406 |
|
407 |
# Log the start time
|
408 |
start_time = time.time()
|
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_{117+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_{117+len(previous_frames)}.png")
|
419 |
previous_frames.append(img)
|
420 |
elif True:
|
421 |
previous_frames.append(next_frame_append)
|
422 |
+
#previous_frames = []
|
423 |
|
424 |
# Convert the numpy array to a base64 encoded image
|
425 |
img = Image.fromarray(next_frame)
|
record_10003/image_10.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_100.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_101.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_102.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_103.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_104.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_105.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_106.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_107.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_108.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_109.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_11.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_110.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_111.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_112.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_113.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_114.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_115.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_116.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_117.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_118.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_119.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_12.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_120.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_121.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_122.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_123.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_124.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_125.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_126.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_127.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_128.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_129.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_13.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_130.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_131.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_132.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_133.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_134.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_135.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_136.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_137.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_138.png
ADDED
![]() |
Git LFS Details
|
record_10003/image_139.png
ADDED
![]() |
Git LFS Details
|