gif fix
Browse files
src/proxy_lite/{gif_marker.py → gif_maker.py}
RENAMED
|
@@ -10,7 +10,7 @@ from proxy_lite.recorder import Run
|
|
| 10 |
|
| 11 |
|
| 12 |
def create_run_gif(
|
| 13 |
-
run: Run, output_path: str, white_panel_width: int = 300, duration: int =
|
| 14 |
) -> None:
|
| 15 |
"""
|
| 16 |
Generate a gif from the Run object's history.
|
|
@@ -43,7 +43,7 @@ def create_run_gif(
|
|
| 43 |
image_bytes = base64.b64decode(image_data)
|
| 44 |
obs_img = Image.open(BytesIO(image_bytes)).convert("RGB")
|
| 45 |
|
| 46 |
-
# scale the image down
|
| 47 |
obs_img = obs_img.resize((obs_img.width // resize_factor, obs_img.height // resize_factor))
|
| 48 |
|
| 49 |
# Check if the next record is an Action and extract its text if available
|
|
@@ -62,7 +62,7 @@ def create_run_gif(
|
|
| 62 |
thinking_content = thinking_match.group(1).strip() if thinking_match else None
|
| 63 |
|
| 64 |
if observation_content and thinking_content:
|
| 65 |
-
action_text = f"
|
| 66 |
|
| 67 |
# Create a white panel (same height as the observation image)
|
| 68 |
panel = Image.new("RGB", (white_panel_width, obs_img.height), "white")
|
|
@@ -111,8 +111,6 @@ def create_run_gif(
|
|
| 111 |
|
| 112 |
# Example usage:
|
| 113 |
if __name__ == "__main__":
|
| 114 |
-
# This is a simple example to demonstrate usage.
|
| 115 |
-
# In practice, replace this with your actual Run object.
|
| 116 |
from proxy_lite.recorder import Run
|
| 117 |
|
| 118 |
dummy_run = Run.load("0abdb4cb-f289-48b0-ba13-35ed1210f7c1")
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
def create_run_gif(
|
| 13 |
+
run: Run, output_path: str, white_panel_width: int = 300, duration: int = 1500, resize_factor: int = 4
|
| 14 |
) -> None:
|
| 15 |
"""
|
| 16 |
Generate a gif from the Run object's history.
|
|
|
|
| 43 |
image_bytes = base64.b64decode(image_data)
|
| 44 |
obs_img = Image.open(BytesIO(image_bytes)).convert("RGB")
|
| 45 |
|
| 46 |
+
# scale the image down
|
| 47 |
obs_img = obs_img.resize((obs_img.width // resize_factor, obs_img.height // resize_factor))
|
| 48 |
|
| 49 |
# Check if the next record is an Action and extract its text if available
|
|
|
|
| 62 |
thinking_content = thinking_match.group(1).strip() if thinking_match else None
|
| 63 |
|
| 64 |
if observation_content and thinking_content:
|
| 65 |
+
action_text = f"**OBSERVATION**\n{observation_content}\n\n**THINKING**\n{thinking_content}"
|
| 66 |
|
| 67 |
# Create a white panel (same height as the observation image)
|
| 68 |
panel = Image.new("RGB", (white_panel_width, obs_img.height), "white")
|
|
|
|
| 111 |
|
| 112 |
# Example usage:
|
| 113 |
if __name__ == "__main__":
|
|
|
|
|
|
|
| 114 |
from proxy_lite.recorder import Run
|
| 115 |
|
| 116 |
dummy_run = Run.load("0abdb4cb-f289-48b0-ba13-35ed1210f7c1")
|