SDKs overview

Inferdo offers Software Development Kits (SDKs) to facilitate the integration of its computer vision APIs into various applications. These SDKs abstract the underlying HTTP requests and responses, providing language-native interfaces for interacting with Inferdo's services, such as the Image Recognition API and Object Detection API. By providing pre-built functions and classes, SDKs aim to reduce development time and potential errors associated with direct API calls. The core objective of these libraries is to enable developers to focus on application logic rather than the intricacies of API communication, including authentication, data serialization, and error handling.

The SDKs are designed to support Inferdo's primary use cases, which include real-time image analysis, content moderation automation, building custom vision applications, and e-commerce product tagging. They typically handle the necessary API key management and provide structured methods for sending images, receiving analysis results, and managing custom models. Developers can refer to the Inferdo developer documentation for comprehensive guides and examples on using the SDKs to implement specific vision tasks.

Official SDKs by language

Inferdo provides official SDKs for popular programming languages, ensuring direct support and maintenance from the Inferdo team. These SDKs are the recommended method for integrating Inferdo's API services, as they are kept up-to-date with API changes and best practices. The official SDKs abstract the complexities of HTTP requests, authentication, and response parsing, allowing developers to interact with the API using native language constructs. For detailed usage and API specifics, developers should consult the Inferdo API Reference and the language-specific SDK documentation.

Language Package Name Installation Command Maturity Documentation
Python inferdo-python-sdk pip install inferdo-python-sdk Stable Inferdo Python SDK docs
Node.js @inferdo/nodejs-sdk npm install @inferdo/nodejs-sdk or yarn add @inferdo/nodejs-sdk Stable Inferdo Node.js SDK docs

These SDKs are maintained to ensure compatibility with the latest API versions and to provide developers with a consistent experience. They typically include modules for authentication, making requests to various Inferdo endpoints (e.g., image analysis, object detection, custom model interactions), and parsing the JSON responses into native data structures.

Installation

Installing Inferdo's official SDKs involves using the standard package managers for Python and Node.js. Follow the instructions below for your preferred development environment. Prior to installation, ensure that you have the respective language runtime and package manager set up on your system.

Python SDK Installation

The Inferdo Python SDK can be installed using pip, the Python package installer. This command retrieves the package from PyPI (Python Package Index).

pip install inferdo-python-sdk

After installation, you can verify it by attempting to import the library in a Python interpreter or script. For more advanced Python packaging, tools like Poetry or Pipenv can manage dependencies in virtual environments.

Node.js SDK Installation

The Inferdo Node.js SDK is available via npm (Node Package Manager) or Yarn. Choose the command that corresponds to your project's package manager.

Using npm:

npm install @inferdo/nodejs-sdk

Using Yarn:

yarn add @inferdo/nodejs-sdk

Once installed, the package can be imported into your Node.js applications. These commands add the @inferdo/nodejs-sdk to your project's node_modules directory and update your package.json file, registering it as a dependency. Further details on Node.js package management are available in the npm install documentation.

Quickstart example

This section provides a basic quickstart example for both Python and Node.js, demonstrating how to initialize the Inferdo SDK and perform a simple image analysis task. These examples assume you have already obtained an API key from your Inferdo account and have installed the respective SDK.

Python Quickstart: Image Recognition

This Python example shows how to use the inferdo-python-sdk to analyze an image for recognition purposes. Replace "YOUR_API_KEY" with your actual Inferdo API key and "path/to/your/image.jpg" with the path to the image you wish to analyze.

import os
from inferdo_python_sdk import InferdoClient

# Initialize the client with your API key
api_key = os.environ.get("INFERDO_API_KEY", "YOUR_API_KEY")
client = InferdoClient(api_key=api_key)

# Path to the image file
image_path = "path/to/your/image.jpg" # Replace with your image path

try:
    # Perform image recognition
    with open(image_path, "rb") as image_file:
        response = client.image.recognize(image=image_file)

    # Print the recognition results
    print("Image Recognition Results:")
    for label in response.labels:
        print(f"- {label.name}: {label.confidence:.2f}")

except Exception as e:
    print(f"An error occurred: {e}")

Node.js Quickstart: Object Detection

This Node.js example illustrates how to use the @inferdo/nodejs-sdk to perform object detection on an image. Ensure you replace "YOUR_API_KEY" with your Inferdo API key and "./path/to/your/image.jpg" with the correct path to your image file.

const InferdoClient = require('@inferdo/nodejs-sdk');
const fs = require('fs');

// Initialize the client with your API key
const client = new InferdoClient({
    apiKey: process.env.INFERDO_API_KEY || 'YOUR_API_KEY',
});

// Path to the image file
const imagePath = './path/to/your/image.jpg'; // Replace with your image path

async function detectObjects() {
    try {
        // Read the image file as a buffer
        const imageBuffer = fs.readFileSync(imagePath);

        // Perform object detection
        const response = await client.object.detect({ image: imageBuffer });

        // Print the detection results
        console.log('Object Detection Results:');
        if (response.objects && response.objects.length > 0) {
            response.objects.forEach(obj => {
                console.log(`- ${obj.label}: ${obj.confidence.toFixed(2)} (Box: x=${obj.box.x}, y=${obj.box.y}, w=${obj.box.width}, h=${obj.box.height})`);
            });
        } else {
            console.log('No objects detected.');
        }
    } catch (error) {
        console.error('An error occurred:', error);
    }
}

detectObjects();

These quickstart examples provide a foundation for integrating Inferdo's computer vision capabilities into your applications. For more complex use cases or to explore other API features, refer to the Inferdo API reference documentation.

Community libraries

While Inferdo provides official SDKs, the developer community may also contribute third-party libraries or wrappers around the Inferdo API. These community-driven projects can sometimes offer additional functionalities, integrations with popular frameworks, or alternative language support not officially provided. However, it is important to note that community libraries are not directly supported or maintained by Inferdo. Developers using third-party libraries should review their source code, licensing, and maintenance status to ensure they meet project requirements and security standards.

To discover community libraries, developers typically explore platforms like GitHub, PyPI for Python packages, or npm for Node.js modules, often searching for terms like "Inferdo API wrapper" or "Inferdo client library." While Inferdo's official documentation focuses on its own SDKs, the extensibility of web APIs encourages the creation of community tools, similar to how other platforms like Google's API Client Libraries or Stripe's SDKs foster a broader ecosystem of integrations. Users should exercise due diligence when selecting and implementing non-official libraries, verifying their compatibility with the current Inferdo API version and their adherence to security best practices.