chore: cleanup ruff flake8-simplify linter rules (#8286)
Co-authored-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
@@ -206,10 +206,9 @@ class StableDiffusionTool(BuiltinTool):
|
||||
|
||||
# Convert image to RGB and save as PNG
|
||||
try:
|
||||
with Image.open(io.BytesIO(image_binary)) as image:
|
||||
with io.BytesIO() as buffer:
|
||||
image.convert("RGB").save(buffer, format="PNG")
|
||||
image_binary = buffer.getvalue()
|
||||
with Image.open(io.BytesIO(image_binary)) as image, io.BytesIO() as buffer:
|
||||
image.convert("RGB").save(buffer, format="PNG")
|
||||
image_binary = buffer.getvalue()
|
||||
except Exception as e:
|
||||
return self.create_text_message(f"Failed to process the image: {str(e)}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user