Inputs from Object Stores

Reference inputs saved in object stores within inference requests sent to Modzy

Modzy provides connectors to multiple object stores including AWS S3, Azure Blob Storage, and NetApp StorageGRID that makes it possible to process data stored in these object stores. The examples below demonstrate how to references individual objects, or entire buckets, within an inference job request. Each of these examples demonstrate how to process stored videos through Modzy's Deep Fake Detection model (model ID: 93ltr2oepu). To use the examples below, you will need to replace placeholder values with valid inputs:

  • Replace https://trial.app.modzy.com/ with the URL of your instance of Modzy
  • Replace API_KEY with a valid Modzy API key string

Single Inputs

AWS S3

  • Replace ACCESS_KEY_ID and SECRET_KEY with valid AWS credentials
  • Update the bucket and key fields within the sources object, to connect to the correct s3 bucket
curl https://trial.app.modzy.com/api/jobs -X POST \
 -H 'Content-Type: application/json' \
 -H 'Authorization: ApiKey API_KEY' \
 -d '{
      "model": {
        "identifier": "93ltr2oepu",
        "version": "0.0.7"
      },
      "input": {
        "type": "aws-s3",
        "accessKeyID": ACCESS_KEY_ID,
        "secretAccessKey": SECRET_KEY,
        "region": "us-east-1",
        "sources": {
          "sampleVideo": {
            "input.mp4": {
              "bucket": "dev-modzy-demo-data",
              "key": "Deepfake Detection/Seoul - 21985.mp4"
        }
      }
    }
  }
}'
const modzy = require("@modzy/modzy-sdk");

//Initialize the client
const modzyClient = new modzy.ModzyClient("https://trial.app.modzy.com/api", API_KEY)

//Add information needed to your AWS S3 bucket
const accessKey = ACCESS_KEY_ID;
const secretAccessKey = SECRET_KEY;
const region = "us-east-1";
const bucketName = "dev-modzy-demo-data";
const fileKey = "Deepfake Detection/Seoul - 21985.mp4";

//Create the source object for the Deepfake Detection model
let sources = { "sampleVideo": { "input.mp4": { 'bucket': bucketName, 'key': fileKey } } };

//We submit the video found in S3 to Modzy's Deepfake Detection model (Id: 93ltr2oepu)
modzyClient
  .submitJobAWSS3("93ltr2oepu", "0.0.7", accessKey, secretAccessKey, region, sources)
  .then(
    (job)=>{
      console.log(JSON.stringify(job));
    }
  )
  .catch(
    (error)=>{
      console.error("Modzy job submission failed with code " + error.code + " and message " + error.message);
    }
  );
import json
from modzy import ApiClient

# Initialize your Modzy client
client = ApiClient(base_url="https://trial.app.modzy.com/api", api_key=API_KEY)

# Add information needed to access your AWS S3 bucket
ACCESS_KEY = ACCESS_KEY_ID
SECRET_ACCESS_KEY = SECRET_KEY
REGION = "us-east-1"
BUCKET_NAME="dev-modzy-demo-data"
FILE_KEY="Deepfake Detection/Seoul - 21985.mp4"

# Create the source object for the Deepfake Detection model
sources = {"sample-video": {"input.mp4": {'bucket': BUCKET_NAME, 'key': FILE_KEY}}}

# Submit the video found in S3 to Modzy's Deepfake Detection model (Id: 93ltr2oepu)
job = client.jobs.submit_aws_s3("93ltr2oepu", "0.0.7", sources, ACCESS_KEY, SECRET_ACCESS_KEY, REGION)

Azure Blob Storage

  • Replace myAzureStorageAccount and cvx....ytw== with your Azure credentials
  • Update the other fields, as necessary, to connect to your Azure Blob Storage bucket
curl https://trial.app.modzy.com/api/jobs -X POST \
 -H 'Content-Type: application/json' \
 -H 'Authorization: ApiKey API_KEY' \
 -d '{
   "model":{
       "identifier": "93ltr2oepu",
       "version": "0.0.7"
   },
   "input": {
       "type": "azureblob",
       "storageAccount": "myAzureStorageAccount",
       "storageAccountKey": "cvx....ytw==",
         "sources": {
           "sampleVideo": {
               "input.mp4": {
                   "container": "demoData",
                   "filePath": "Deepfake Detection/Seoul - 21985.mp4"
                } 
            }                   
       }
   }
}'

NetApp StorageGRID

  • Replace key and secret-key with your StorageGRID credentials
  • Replace endpoint with the URL of your instance of StorageGRID
  • Update the other fields, as necessary, to connect to your StorageGRID bucket
curl https://trial.app.modzy.com/api/jobs -X POST \
 -H 'Content-Type: application/json' \
 -H 'Authorization: ApiKey API_KEY' \
 -d '{
  "model": {
    "identifier": "93ltr2oepu",
    "version": "0.0.7"
 },
  "input": {
    "type": "storage-grid",
    "accessKeyID": "key",
    "secretAccessKey": "secret-key",
    "endpoint": "https://endpoint.example",
    "sources": {
      "SampleVideo": {
        "input.mp4": {
          "bucket": "demoData",
          "key": "Deepfake Detection/Seoul - 21985.mp4"
        }
      }
    }
  }
}'

Entire Bucket or Folder

AWS S3 Folder

If you need to process all of the objects within a given folder in bulk, use the aws-s3-folder input type and use the entire folder name as the key instead of a specific file.

curl https://trial.app.modzy.com/api/jobs -X POST \
 -H 'Content-Type: application/json' \
 -H 'Authorization: ApiKey API_KEY' \
 -d '{
      "model": {
        "identifier": "93ltr2oepu",
        "version": "0.0.7"
      },
      "input": {
        "type": "aws-s3-folder",
        "accessKeyID": ACCESS_KEY_ID,
        "secretAccessKey": SECRET_KEY,
        "region": "us-east-1",
        "sources": {
          "sampleVideo": {
            "input.mp4": {
              "bucket": "dev-modzy-demo-data",
              "key": "Deepfake Detection"
        }
      }
    }
  }
}'