Inputs from Object Stores
Reference inputs saved in object stores within inference requests sent to Modzy
Modzy provides an AWS S3 connector that makes it possible to process data stored in AWS S3. 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 videos stored on S3 through Modzy's Deep Fake Detection model. To use the examples below, you will need to replace placeholder values with valid inputs:
- Replace
API_KEY
with a valid Modzy API key string - Replace
ACCESS_KEY_ID
andSECRET_KEY
with your AWS credentials - Update the other fields, as necessary, to connect to your S3 bucket
- If necessary, replace
https://app.modzy.com/
with the URL of your instance of Modzy
AWS S3 - Single Input
curl https://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 fs = require('fs');
const modzy = require("@modzy/modzy-sdk");
//Initialize the client
const modzyClient = new modzy.ModzyClient("https://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);
}
);
AWS S3 - Entire Bucket
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://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"
}
}
}
}
}'
Updated 4 months ago
Did this page help you?