> For the complete documentation index, see [llms.txt](https://docs.degirum.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.degirum.com/hailo/basics/running-inference/images.md).

# 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_hailort_multidevice_1",
    zoo_url="degirum/hailo",
    inference_host_address="@local",
    model_properties={"device_type": ["HAILORT/HAILO8", "HAILORT/HAILO8L"]},
)
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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.degirum.com/hailo/basics/running-inference/images.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
