Skip to content

roboflow/inference-sdk-js

Repository files navigation

@roboflow/inference-sdk

Lightweight client for Roboflow's hosted inference API with WebRTC streaming support for real-time computer vision in the browser.

Installation

npm install @roboflow/inference-sdk

Quick Example

import { useStream, connectors } from '@roboflow/inference-sdk';
import { useCamera } from '@roboflow/inference-sdk/streams';

const stream = await useCamera({ video: { facingMode: "environment" } });
const connection = await useStream({
  source: stream,
  connector: connectors.withProxyUrl('/api/init-webrtc'), // Use backend proxy
  wrtcParams: { workflowSpec: { /* ... */ } },
  onData: (data) => console.log("Inference results:", data)
});

const videoElement.srcObject = await connection.remoteStream();

See the sample app for a complete working example.

Security Warning

Never expose your API key in frontend code. Always use a backend proxy for production applications. The sample app demonstrates the recommended proxy pattern.

Get Started

For a complete working example with backend proxy setup, see: github.com/roboflow/inferenceSampleApp

Resources

License

See the main repository for license information.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published