Spaces:
Runtime error
Runtime error
Commit
·
5587923
1
Parent(s):
e5c7a80
Update main.py
Browse files
main.py
CHANGED
@@ -29,10 +29,14 @@ def generate_random_image(width: int, height: int) -> np.ndarray:
|
|
29 |
def draw_trace(image: np.ndarray, previous_actions: List[Tuple[str, List[int]]]) -> np.ndarray:
|
30 |
pil_image = Image.fromarray(image)
|
31 |
draw = ImageDraw.Draw(pil_image)
|
32 |
-
|
33 |
for i, (action_type, position) in enumerate(previous_actions):
|
34 |
color = (255, 0, 0) if action_type == "move" else (0, 255, 0)
|
35 |
x, y = position
|
|
|
|
|
|
|
|
|
36 |
if DEBUG:
|
37 |
x = x * 256 / 1024
|
38 |
y = y * 256 / 1024
|
|
|
29 |
def draw_trace(image: np.ndarray, previous_actions: List[Tuple[str, List[int]]]) -> np.ndarray:
|
30 |
pil_image = Image.fromarray(image)
|
31 |
draw = ImageDraw.Draw(pil_image)
|
32 |
+
flag = True
|
33 |
for i, (action_type, position) in enumerate(previous_actions):
|
34 |
color = (255, 0, 0) if action_type == "move" else (0, 255, 0)
|
35 |
x, y = position
|
36 |
+
if x === 0 and y == 0 and flag:
|
37 |
+
continue
|
38 |
+
else:
|
39 |
+
flag = False
|
40 |
if DEBUG:
|
41 |
x = x * 256 / 1024
|
42 |
y = y * 256 / 1024
|