Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AsiaCao committed Apr 23, 2024
1 parent fad3b18 commit 5bc186b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions vision_agent/agent/vision_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,14 +486,16 @@ def log_progress(self, description: str) -> None:
if self.report_progress_callback:
self.report_progress_callback(description)

def _report_visualization_via_callback(self, images: List[Union[str, Path]]) -> None:
def _report_visualization_via_callback(
self, images: Sequence[Union[str, Path]]
) -> None:
"""This is intended for streaming the visualization images via the callback to the client side."""
if self.report_progress_callback:
self.report_progress_callback("<VIZ>" )
self.report_progress_callback("<VIZ>")
if images:
for img in images:
self.report_progress_callback(f"<IMG>{convert_to_b64(img)}</IMG>")
self.report_progress_callback("</VIZ>" )
self.report_progress_callback("</VIZ>")

def chat_with_workflow(
self,
Expand Down
2 changes: 1 addition & 1 deletion vision_agent/image_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def convert_to_b64(data: Union[str, Path, np.ndarray, ImageType]) -> str:
data = Image.open(data)
if isinstance(data, Image.Image):
buffer = BytesIO()
data.convert("RGB").save(buffer, format="JPEG")
data.convert("RGB").save(buffer, format="PNG")
return base64.b64encode(buffer.getvalue()).decode("utf-8")
else:
arr_bytes = data.tobytes()
Expand Down

0 comments on commit 5bc186b

Please sign in to comment.