File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed
dockerfiles/RunCellpose_CellposeOmnipose Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change 1- NAME ?= runcellpose_omnipose_no_pretrained
1+ NAME ?= runcellpose_omnipose_with_pretrained
22TAG ?= 1.0.2
33REPO ?= cellprofiler
44IMG := $(REPO ) /$(NAME ) :$(TAG )
Original file line number Diff line number Diff line change 1+ import cellpose
2+ import cellpose_omni
3+ from cellpose .models import MODEL_NAMES
4+
5+ for m in ["cyto" , "nuclei" , "cyto2" ]:
6+ model = cellpose .models .Cellpose (gpu = True , model_type = m )
7+ if model in ("cyto" , "nuclei" , "cyto2" ):
8+ size_model_name = cellpose .models .size_model_path (model )
9+
10+ import urllib .request
11+ import zipfile
12+ import os
13+
14+ url = "https://files.osf.io/v1/resources/xmury/providers/osfstorage/646d978ef4be380b5362bb64/?zip="
15+ filename = "omnipose_models.zip"
16+
17+ try :
18+ urllib .request .urlretrieve (url , filename )
19+ print (f"File downloaded successfully to { filename } " )
20+ except Exception as e :
21+ print (f"Error downloading file: { e } " )
22+
23+ destination_directory = os .path .expanduser ("~/.cellpose/models/" )
24+
25+ # Create the destination directory if it doesn't already exist
26+ os .makedirs (destination_directory , exist_ok = True )
27+
28+ try :
29+ # Open the zip file in read mode ('r')
30+ with zipfile .ZipFile (filename , 'r' ) as zip_ref :
31+ print (f"Extracting all contents of '{ filename } ' to '{ destination_directory } '..." )
32+ # Extract all the contents to the specified directory
33+ zip_ref .extractall (destination_directory )
34+ except Exception as e :
35+ print (f"An unexpected error occurred: { e } " )
You can’t perform that action at this time.
0 commit comments