# Run a Model on an Image

You can use the Roboflow CLI to run a model trained on Roboflow, or with open source models available on [Roboflow Universe](https://universe.roboflow.com).

By running `roboflow infer` in the command line, the CLI sends the image to the Roboflow API and prints the predictions.

## Command

```bash
roboflow infer <image-path> -m <project/version>
```

### Options

| Flag                 | Description                                                                                                                                    |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `-m`, `--model`      | Model ID in `project/version` format (required)                                                                                                |
| `-c`, `--confidence` | Confidence threshold, 0.0–1.0 (default: 0.5)                                                                                                   |
| `-o`, `--overlap`    | Overlap/NMS threshold, 0.0–1.0 (default: 0.5)                                                                                                  |
| `-t`, `--type`       | Model type (skip auto-detection): `object-detection`, `classification`, `instance-segmentation`, `semantic-segmentation`, `keypoint-detection` |

## Examples

Run inference using an open source model from Roboflow Universe — for example, the [poker-cards](https://universe.roboflow.com/roboflow-100/poker-cards-cxcvz/model/1) dataset:

```bash
roboflow infer ~/Downloads/ace.jpg -m poker-cards-cxcvz/1 -c 0.7
```

The workspace defaults to your configured workspace. To use a model from a different workspace:

```bash
roboflow infer photo.jpg -m poker-cards-cxcvz/1 -w roboflow-100
```

Specify the model type to skip the auto-detection API call:

```bash
roboflow infer photo.jpg -m my-project/3 -t object-detection
```

## JSON Output

Use `--json` to get structured prediction data for scripting and automation:

```bash
roboflow infer photo.jpg -m my-project/3 --json
```

```json
{
  "predictions": [
    {
      "x": 1230.0,
      "y": 814.5,
      "width": 840.0,
      "height": 1273.0,
      "confidence": 0.882,
      "class": "Scissors",
      "class_id": 2
    }
  ]
}
```

See all supported parameters with `roboflow infer --help`.
