mart9992 commited on
Commit
d4fec88
1 Parent(s): a32aec9
Files changed (1) hide show
  1. handler.py +9 -4
handler.py CHANGED
@@ -126,10 +126,15 @@ sam_model = None
126
 
127
 
128
  def get_sam_vit_h_4b8939():
129
- if not os.path.exists('./sam_vit_h_4b8939.pth'):
130
- logger.info(f"get sam_vit_h_4b8939.pth...")
131
- result = subprocess.run(['wget', 'https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth'], check=True)
132
- print(f'wget sam_vit_h_4b8939.pth result = {result}')
 
 
 
 
 
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...")