- handler.py +9 -4
handler.py
CHANGED
@@ -126,10 +126,15 @@ sam_model = None
|
|
126 |
|
127 |
|
128 |
def get_sam_vit_h_4b8939():
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
|
|
|
|
|
|
|
|
|
|
133 |
|
134 |
get_sam_vit_h_4b8939()
|
135 |
logger.info(f"initialize SAM model...")
|
|
|
126 |
|
127 |
|
128 |
def get_sam_vit_h_4b8939():
|
129 |
+
url = 'https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth'
|
130 |
+
file_path = './sam_vit_h_4b8939.pth'
|
131 |
+
|
132 |
+
if not os.path.exists(file_path):
|
133 |
+
logger.info("Downloading sam_vit_h_4b8939.pth...")
|
134 |
+
response = requests.get(url)
|
135 |
+
with open(file_path, 'wb') as f:
|
136 |
+
f.write(response.content)
|
137 |
+
print('Downloaded sam_vit_h_4b8939.pth')
|
138 |
|
139 |
get_sam_vit_h_4b8939()
|
140 |
logger.info(f"initialize SAM model...")
|