VISTA-3D is a specialized interactive foundation model for segmenting and anotating human anatomies.
Follow the steps below to download and run the NVIDIA NIM inference microservice for this model on your infrastructure of choice.
NGC_API_KEY
variable.export NGC_API_KEY=<your personal NGC key>
export LOCAL_NIM_CACHE=~/.cache/nim mkdir -p $LOCAL_NIM_CACHE
Note that you may need to run (sudo) chmod -R 777 $LOCAL_NIM_CACHE
after the VISTA-3D model is downloaded to avoid permission issues.
docker run --rm -it --name vista3d \ --runtime=nvidia -e CUDA_VISIBLE_DEVICES=0 \ --shm-size=8G \ -p 8000:8000 \ -e NGC_API_KEY=$NGC_API_KEY \ nvcr.io/nim/nvidia/vista3d:latest
This command will start the NIM container and expose port 8000 for the user to interact with the NIM.
{"status":"ready"}
before proceeding. This may take a couple of minutes. You can use the following command to query the health check.curl -X 'GET' \ 'http://localhost:8000/v1/health/ready' \ -H 'accept: application/json'
nim_client.py
.import requests import zipfile base_url = "http://localhost:8000" data = { "image": "https://assets.ngc.nvidia.com/products/api-catalog/vista3d/example-1.nii.gz", } def unzip_file(zip_filepath, dest_dir): with zipfile.ZipFile(zip_filepath, 'r') as zip_ref: zip_ref.extractall(dest_dir) response = requests.post(f"{base_url}/v1/vista3d/inference", json=data) if response.status_code == 200: output_folder = "output" output_zip_name = "output.zip" with open(output_zip_name, "wb") as f: f.write(response.content) unzip_file(output_zip_name, output_folder)
python nim_client.py
output.zip
.cat output.zip
nim_client.sh
.LOCAL_URL='http://localhost:8000/v1/vista3d/inference' DATA=$(cat <<EOF { "image": "https://assets.ngc.nvidia.com/products/api-catalog/vista3d/example-1.nii.gz" } EOF ) response=$(curl -s -o output.zip -w "%{http_code}" -X POST -H "Content-Type: application/json" -d "$DATA" $LOCAL_URL) if [ "$response" -eq 200 ]; then echo "Response Success, save inference results into folder: output" unzip -o "output.zip" -d "output" else echo "Request failed with status $response" fi
chmod +x nim_client.sh ./nim_client.sh