From c182921ece23bd1cf95402e14b202496a5e3d1bd Mon Sep 17 00:00:00 2001 From: Junjie Bai Date: Wed, 8 Nov 2023 19:53:53 +0000 Subject: [PATCH] Fix lint error introduced in #52 --- advanced/segment-anything/sam.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/advanced/segment-anything/sam.py b/advanced/segment-anything/sam.py index 87f1a63..c51de0f 100644 --- a/advanced/segment-anything/sam.py +++ b/advanced/segment-anything/sam.py @@ -144,7 +144,9 @@ def predict_url(self, url: str) -> LeptonPickled: # urllib to do this. Note that this is just an example - you can use any method # to download the image. try: - raw_img = np.asarray(Image.open(io.BytesIO(urlopen(url).read())).convert("RGB")) + raw_img = np.asarray( + Image.open(io.BytesIO(urlopen(url).read())).convert("RGB") + ) except Exception as e: # HTTPException is a special exception that will be translated to a proper # http error by fastAPI and return to the user side. In this case, we will @@ -203,7 +205,9 @@ def generate_mask(self, url: str) -> PNGResponse: masks. """ try: - raw_img = np.asarray(Image.open(io.BytesIO(urlopen(url).read())).convert("RGB")) + raw_img = np.asarray( + Image.open(io.BytesIO(urlopen(url).read())).convert("RGB") + ) except Exception as e: raise HTTPException( status_code=400,