From 80ae3fd132210c8bd3eb3b09914410e4a014d3cc Mon Sep 17 00:00:00 2001 From: ahmednasserswe Date: Mon, 29 Jan 2024 13:46:56 +0100 Subject: [PATCH] specific exception handle for reading sscd model's file not found exception --- lib/model/image_sscd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/model/image_sscd.py b/lib/model/image_sscd.py index c869cd2..81fa36d 100644 --- a/lib/model/image_sscd.py +++ b/lib/model/image_sscd.py @@ -19,7 +19,7 @@ def __init__(self): #FIXME: Load from a Meedan S3 bucket try: self.model = torch.jit.load("sscd_disc_mixup.torchscript.pt") - except: + except FileNotFoundError: logger.info("Downloading SSCD model...") m=urllib.request.urlopen("https://dl.fbaipublicfiles.com/sscd-copy-detection/sscd_disc_mixup.torchscript.pt").read() with open("sscd_disc_mixup.torchscript.pt","wb") as fh: