# Images

*Estimated read time: 2 minutes*

The simplest way to run inference on an image is to call the model like a function. Model objects are callable—they implement `__call__`, which delegates to `predict`. In other words:

{% code overflow="wrap" %}

```python
result = model(
    image_source
)  # exactly the same as: result = model.predict(image_source)
```

{% endcode %}

This page shows how to run inference on three common input types: a URL, a local file path, and a NumPy array.

## Common setup (used in all cases)

{% code overflow="wrap" %}

```python
from degirum_tools import ModelSpec, Display

# Configure & load once
model_spec = ModelSpec(
    model_name="yolov8n_coco--640x640_quant_axelera_metis_1",
    zoo_url="degirum/axelera",
    inference_host_address="@local",
    model_properties={"device_type": ["AXELERA/METIS"]},
)
model = model_spec.load_model()
```

{% endcode %}

## Image URL

{% code overflow="wrap" %}

```python
from degirum_tools import remote_assets  # small gallery of public sample URLs

image_url = remote_assets.three_persons  # or any reachable image URL (string)
result = model(image_url)

with Display("AI Camera — URL") as output_display:
    output_display.show_image(result.image_overlay)
```

{% endcode %}

{% hint style="info" %}
URLs behind authentication or hosted on an intranet may fail if your runtime can't access them.
{% endhint %}

## Local file path

{% code overflow="wrap" %}

```python
from pathlib import Path

image_path = Path.home() / "Pictures" / "test.jpg"  # change as needed
result = model(str(image_path))  # file paths are accepted

with Display("AI Camera — File") as output_display:
    output_display.show_image(result.image_overlay)
```

{% endcode %}

{% hint style="info" %}
Windows: Use raw strings for paths, e.g., `r"C:\Users\you\Pictures\test.jpg"`.
{% endhint %}

## NumPy array

{% code overflow="wrap" %}

```python
# pip install opencv-python
import cv2

frame_bgr = cv2.imread("test.jpg")  # returns BGR ndarray
if frame_bgr is None:
    raise FileNotFoundError("Could not read test.jpg")

result = model(frame_bgr)

with Display("AI Camera — Array") as output_display:
    output_display.show_image(result.image_overlay)
```

{% endcode %}

That’s it—choose the type that matches your input, reuse the common setup, and call `model(...)` or `model.predict(...)` to get results.


---

# 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.degirum.com/axelera/basics/running-inference/images.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.
