Spaces:
Runtime error
Runtime error
Commit
·
ec4fd5b
1
Parent(s):
0b113cb
Update main.py
Browse files
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
|
|
@@ -352,14 +352,17 @@ async def websocket_endpoint(websocket: WebSocket):
|
|
| 352 |
start_time = time.time()
|
| 353 |
|
| 354 |
# Predict the next frame based on the previous frames and actions
|
| 355 |
-
|
|
|
|
| 356 |
|
| 357 |
next_frame, next_frame_append = predict_next_frame(previous_frames, previous_actions)
|
| 358 |
# Load and append the corresponding ground truth image instead of model output
|
| 359 |
print ('here4', len(previous_frames))
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
|
|
|
|
|
|
| 363 |
|
| 364 |
# Convert the numpy array to a base64 encoded image
|
| 365 |
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
|
|
|
|
| 352 |
start_time = time.time()
|
| 353 |
|
| 354 |
# Predict the next frame based on the previous frames and actions
|
| 355 |
+
if DEBUG_TEACHER_FORCING:
|
| 356 |
+
print ('predicting', f"record_100/image_{82+len(previous_frames)}.png")
|
| 357 |
|
| 358 |
next_frame, next_frame_append = predict_next_frame(previous_frames, previous_actions)
|
| 359 |
# Load and append the corresponding ground truth image instead of model output
|
| 360 |
print ('here4', len(previous_frames))
|
| 361 |
+
if DEBUG_TEACHER_FORCING:
|
| 362 |
+
img = Image.open(f"record_100/image_{82+len(previous_frames)}.png")
|
| 363 |
+
previous_frames.append(img)
|
| 364 |
+
else:
|
| 365 |
+
previous_frames.append(next_frame_append)
|
| 366 |
|
| 367 |
# Convert the numpy array to a base64 encoded image
|
| 368 |
img = Image.fromarray(next_frame)
|