Skip to main content

Python CLI (name : nufictl) for CRD npudeploy

poetry shell
poetry install
  • example usage
from nufisdk import NufiSdk
from img_utils import preprocess_image, postprocess_results, create_output_path

# Config Constants
CONTAINER_IMAGE_NAME = "[Your NPU Deploy Image]"
NUFI_SERVER_URL = "[Your NuFi Server URL]"
NPU_SERVER_URL = "[Your NPU Deployment URL]"
MODEL_NAME = "yolov7"
MODEL_PATH = "./x330_yolo/models/yolov7.smp"
IMAGE_PATH = "./x330_yolo/datasets/imgs/kite.jpg"
OUTPUT_PATH = create_output_path(IMAGE_PATH)

nfk = NufiSdk()


# simple example
def simple():
    nfk.config.set("x330_server", NUFI_SERVER_URL)
    nfk.config.set_current_context("x330_server")
    preprocessed_img = preprocess_image(IMAGE_PATH)
    nfk.x330.set_inference_url(NPU_SERVER_URL)
    nfk.x330.upload_model(MODEL_NAME, MODEL_PATH)
    nfk.x330.run_inference(MODEL_NAME, preprocessed_img, OUTPUT_PATH)
    postprocess_results(IMAGE_PATH, OUTPUT_PATH)


# detailed example
def detail():
    nfk.config.set("x330_server", NUFI_SERVER_URL)
    nfk.config.set_current_context("x330_server")

    deployments = nfk.list_deployments()
    print(f"Found {len(deployments)} deployments.")
    for deploy in deployments:
        print(f" - {deploy.name}: {deploy.endpoint}")

    preprocessed_img = preprocess_image(IMAGE_PATH)

    print("Configuring X330 inference server...")
    nfk.x330.set_inference_url(NPU_SERVER_URL)
    print(nfk.x330.get_inference_url())

    # # List models on the server
    models = nfk.x330.list_models()
    print(f"Found {len(models)} models on the server.")
    for model in models:
        print(f" - {model}")

    # Upload the model to the X330 server
    print(f"Uploading model '{MODEL_NAME}' to the server...")
    upload_message = nfk.x330.upload_model(MODEL_NAME, MODEL_PATH)
    print(upload_message)

    # # Run inference
    print(f"Running inference on image '{IMAGE_PATH}' using model '{MODEL_NAME}'...")
    inference_result = nfk.x330.run_inference(MODEL_NAME, preprocessed_img, OUTPUT_PATH)
    print("Inference result saved to:", OUTPUT_PATH)

    # # Postprocess results
    print("Postprocessing inference results...")
    postprocess_results(IMAGE_PATH, OUTPUT_PATH)
    print("Postprocessing completed. Check the output image.")


if __name__ == "__main__":
    simple()
    # detail()

Metadata

Release files for nufisdk 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nufisdk 1.0.1
File Size Uploaded Provenance Actions
nufisdk-1.0.1.tar.gz 8.0 kB Without provenance Details for nufisdk-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nufisdk 1.0.1
File Interpreter ABI Platform Actions
nufisdk-1.0.1-py3-none-any.whl Python 3 none any Details for nufisdk-1.0.1-py3-none-any.whl

Total release size: 19.3 kB

Release files / nufisdk-1.0.1.tar.gz

Download URL nufisdk-1.0.1.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
29660cff0c9400ab34dc14b4ed77af713d04740e6e6cdf563d6ff1f088100912
BLAKE2b-256 checksum
How to use checksums
fc0221b350f50f7aa67cd252333934338b92299dd202c2dfb2618c01445bd99e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.3 Darwin/21.6.0

Release files / nufisdk-1.0.1-py3-none-any.whl

Download URL nufisdk-1.0.1-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5a7cfcf6fe500b27a6f387fffd36ab609a55542a107c1bc1c7982623c0f6effa
BLAKE2b-256 checksum
How to use checksums
2c2a0eec6ec39b079a1be3312f297eb9e537243f891db4682ceeddb473e7d94a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.3 Darwin/21.6.0

Security for nufisdk 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page