Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -47,6 +47,8 @@ def initialize_simulator(image_name):
|
|
47 |
|
48 |
@spaces.GPU
|
49 |
def model(direction):
|
|
|
|
|
50 |
if direction == 'right':
|
51 |
action = np.array([0, 0.05])
|
52 |
elif direction == 'left':
|
@@ -59,8 +61,7 @@ def model(direction):
|
|
59 |
raise ValueError(f"Invalid direction: {direction}")
|
60 |
genie_result = genie.step(action, cached_latent_frames=cached_latent_frames, cached_actions=cached_actions)
|
61 |
next_image = genie_result['pred_next_frame']
|
62 |
-
|
63 |
-
global cached_actions
|
64 |
cached_latent_frames = genie_result['set_cached_latent_frames']
|
65 |
cached_actions = genie_result['set_cached_actions']
|
66 |
next_image = cv2.resize(next_image, (RES, RES))
|
|
|
47 |
|
48 |
@spaces.GPU
|
49 |
def model(direction):
|
50 |
+
global cached_latent_frames
|
51 |
+
global cached_actions
|
52 |
if direction == 'right':
|
53 |
action = np.array([0, 0.05])
|
54 |
elif direction == 'left':
|
|
|
61 |
raise ValueError(f"Invalid direction: {direction}")
|
62 |
genie_result = genie.step(action, cached_latent_frames=cached_latent_frames, cached_actions=cached_actions)
|
63 |
next_image = genie_result['pred_next_frame']
|
64 |
+
|
|
|
65 |
cached_latent_frames = genie_result['set_cached_latent_frames']
|
66 |
cached_actions = genie_result['set_cached_actions']
|
67 |
next_image = cv2.resize(next_image, (RES, RES))
|