
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@foyer-inc/insight-sdk
Advanced tools
Additional documentation at Docs
import { ClassifyResult, Insight } from '@foyer-inc/insight-sdk'
//can be initialized with authorization and other defaults or with nothing
const insight = new Insight() or new Insight(options)
const options = {
// bypass login call by providing authorization
// defaults to ''
authorization: string,
// run full model even if cached data exists for this image
// defaults to false
force: boolean,
// must be true for class methods to function
// defaults to false
includeSegmentations: boolean,
// returns tagpoints for location of detection
// defaults to false
includeTagpoints: boolean,
// if only certain detections should be returned include them here
// defaults to ['all']
detectionsRequested: string[]
}
/*
* if not initialized with authorization string you may call login with
* credentials. The authorization token is returned and is also
* automatically added to your insight instance
*/
const authorization = await insight.login('email', 'password')
const url = 'https://myfakewebsite.com/myfakeimage.jpg'
const file = //base 64 encoded string representation of image
/*
*Below are example calls to the classification service
* you can use async/await or promise with a callback function
*/
const result: ClassifyResult = await insight.classify(url)
//Can include a variety of options
//options provided will overrule those set on the insight instance
const anotherResult: ClassifyResult = await insight.classify(url, options)
//Can also send a bulk request with an array of urls or files
const bulkResult: ClassifyResult[] = await insight.bulkClassify([url, url, url], options)
insight.classify(url)
.then( (result: ClassifyResult) => {
// additional work or call class methods
});
}
// A sample of functions available on the result
// an image, as a base64 encoded string, with the requested detection blurred
const blurredImage = await result.blurDetection('detectionName')
// an image of the requested detection with a transparent background
const extractedImage = await result.extractDetection('detectionName')
// returns an array of shape [r,g,b] for the dominant color of the named detection
const color = await result.getDetectionColor('detectionName')
//can also be passed the already extracted detection
const anotherColor = await result.getDetectionColor(extractedImage)
//also possible to check if a detection exists in the result
//returns true or false if detection is present
const found = result.checkDetection('detectionName')
//returns true or false if all detections listed are present
const multipleFound = result.checkDetection(['detectionName', 'anotherDetectionName'])
FAQs
SDK for connecting to Foyer's Insight service(s)
The npm package @foyer-inc/insight-sdk receives a total of 3 weekly downloads. As such, @foyer-inc/insight-sdk popularity was classified as not popular.
We found that @foyer-inc/insight-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.