An open API service indexing awesome lists of open source software.

https://github.com/roboflow/inference-sdk-js


https://github.com/roboflow/inference-sdk-js

Last synced: 6 months ago
JSON representation

Awesome Lists containing this project

README

          

# @roboflow/inference-sdk

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

## Installation

```bash
npm install @roboflow/inference-sdk
```

## Quick Example

```typescript
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](https://github.com/roboflow/inferenceSampleApp) 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](https://github.com/roboflow/inferenceSampleApp)**

## Resources

- [Roboflow Documentation](https://docs.roboflow.com/)
- [API Authentication Guide](https://docs.roboflow.com/api-reference/authentication)
- [Workflows Documentation](https://docs.roboflow.com/workflows)

## License

See the main repository for license information.