@@ -1315,16 +1315,44 @@ def micro_sam_info():
13151315 )
13161316 )
13171317
1318+ # Creating a cache directory when users' run `micro_sam.info`.
1319+ cache_dir = get_cache_directory ()
1320+ os .makedirs (cache_dir , exist_ok = True )
1321+
13181322 # The cache directory panel.
13191323 console .print (
1320- Panel (f"[bold #009E73]Cache Directory:[/bold #009E73]\n { get_cache_directory () } " , title = "Cache Directory" )
1324+ Panel (f"[bold #009E73]Cache Directory:[/bold #009E73]\n { cache_dir } " , title = "Cache Directory" )
13211325 )
13221326
1323- # The available models panel.
1324- available_models = list (get_model_names ())
1325- # We filter out the decoder models.
1326- available_models = [m for m in available_models if not m .endswith ("_decoder" )]
1327+ # We have a simple versioning logic here (which is what I'll follow here for mapping model versions).
1328+ available_models = []
1329+ for model_name , model_path in models ().urls .items (): # We filter out the decoder models.
1330+ if model_name .endswith ("decoder" ):
1331+ continue
1332+
1333+ if "https://dl.fbaipublicfiles.com/segment_anything/" in model_path : # Valid v1 SAM models.
1334+ available_models .append (model_name )
1335+
1336+ if "https://owncloud.gwdg.de/" in model_path : # Our own hosted models (in their v1 mode quite often)
1337+ if model_name == "vit_t" : # MobileSAM model.
1338+ available_models .append (model_name )
1339+ else :
1340+ available_models .append (f"{ model_name } (v1)" )
1341+
1342+ # Now for our models, the BioImageIO ModelZoo upload structure is such that:
1343+ # '/1/files' corresponds to v2 models.
1344+ # '/1.1/files' corresponds to v3 models.
1345+ # '/1.2/files' corresponds to v4 models.
1346+ if "/1/files" in model_path :
1347+ available_models .append (f"{ model_name } (v2)" )
1348+ if "/1.1/files" in model_path :
1349+ available_models .append (f"{ model_name } (v3)" )
1350+ if "/1.2/files" in model_path :
1351+ available_models .append (f"{ model_name } (v4)" )
1352+
13271353 model_list = "\n " .join (available_models )
1354+
1355+ # The available models panel.
13281356 console .print (
13291357 Panel (f"[bold #D55E00]Available Models:[/bold #D55E00]\n { model_list } " , title = "List of Supported Models" )
13301358 )
0 commit comments