# NatML for JavaScript

## Effortless Machine Learning

NatML is a platform that brings extremely easy and quick machine learning to JavaScript. It allows you to run ML-powered features in your JS application--browser or NodeJS--without managing any ML infrastructure. In a few steps:

First, fetch a **model**:

```typescript
// Fetch the ResNet image classifier model data
const modelData = await MLModelData.fromHub("@natsuite/resnet18");
// Create the model
const model = modelData.deserialize();
```

Then create a **predictor** to make predictions with the model:

```typescript
// Create the ResNet classifier predictor
const predictor = new ResNet18Predictor(model, modelData.labels);
```

Finally, make predictions with the predictor:

```typescript
// Create an image feature
const imageFeature = new MLImageFeature("/path/to/cat 🐱.jpg");
// Classify the cat image with our predictor
const [label, score] = await predictor.predict(imageFeature);
// Log the results to the console
console.log(`Our image contains a ${label} with confidence ${score}`);
```

## Zero Configuration Deployment

NatML is designed for developers to quickly integrate ML functionality into their applications without any knowledge or effort put into building or managing ML infrastructure. Features include:

* **Extremely Easy to Use**. NatML exposes machine learning models with simple functions that return familiar data types.
* **Bare Metal Performance**. NatML runs predictions on powerful GPU's with incredibly high memory and network bandwidth, giving you the highest performance and minimal latency.&#x20;
* **Latest Models.** [NatML Hub](https://hub.natml.ai/) offers a growing catalog of the latest ML models being published from research labs around the world.
* **Computer Vision**. NatML supports models for object classification, object detection, semantic segmentation, style transfer, and so much more.
* **Lightweight Package**. NatML is distributed in a self-contained package weighing less than 100kb, with minimal external dependencies and no setup necessary.

## Get NatML

```bash
# Install NatML
npm i natml --save
```

{% embed url="<https://www.npmjs.com/package/natml>" %}
Get NatML on NPM
{% endembed %}

{% embed url="<https://github.com/natsuite/NatML-JS>" %}
Get NatML on GitHub
{% endembed %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.natml.ai/js/natml-for-javascript.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
