# Remote Assets

{% hint style="info" %}
This API Reference is based on DeGirum Tools version 0.24.1.
{% endhint %}

## Overview

`degirum_tools.remote_assets` is a tiny convenience module that discovers common image files (JPG, JPEG, PNG, BMP, GIF) and MP4/AVI/MOV videos published in the [PySDK Examples](https://github.com/DeGirum/PySDKExamples) repository and exposes them in two ways:

* As dynamic attributes on the module: `remote_assets.<filename_without_extension>` returns a `RemoteMedia` object (a `str` subclass with helpers) that behaves like a URL string.
* As enumerations: `list_images()` and `list_videos()` return dictionaries mapping attribute names to `RemoteMedia` objects; use their keys to list available images/videos.

Each `RemoteMedia` instance is a URL-like string; `remote_assets` does not download or cache assets by itself. Any caching is handled by your application, HTTP stack, or PySDK internals.

## When to Use

* Quickstarts, demos, tests, and tutorials that need a stable sample image or video.
* Prototyping code where you want to avoid bundling media assets in your repo.

## Basic Usage

List available image and video asset names.

{% code overflow="wrap" %}

```python
from degirum_tools import remote_assets

print("Images (names):")
print(sorted(list(remote_assets.list_images().keys())))

print("Videos (names):")
print(sorted(list(remote_assets.list_videos().keys())))
```

{% endcode %}

Example output:

{% code overflow="wrap" %}

```
Images (names):
['bikes', 'car', 'cat', 'fire_place', 'license_plate', 'living_room', 'mask1', 'parking_lot', 'three_persons', 'two_cats']

Videos (names):
['cars_lp', 'example_video', 'faces_and_gender', 'hand_palm', 'parking', 'person_face_hand', 'person_pose', 'store', 'store_short', 'traffic', 'traffic2', 'traffic_hd', 'walking_people', 'walking_people2', 'walking_person']
```

{% endcode %}

Fetch URLs for commonly used assets (a cat image and a walking‑people video).

{% code overflow="wrap" %}

```python
from degirum_tools import remote_assets

# Access via attributes (preferred for readability)
cat_url = remote_assets.cat
walking_people_url = remote_assets.walking_people

print("cat:", cat_url)
print("walking_people:", walking_people_url)
```

{% endcode %}

Example output:

{% code overflow="wrap" %}

```
cat: https://raw.githubusercontent.com/DeGirum/PySDKExamples/main/images/Cat.jpg
walking_people: https://raw.githubusercontent.com/DeGirum/PySDKExamples/main/images/WalkingPeople.mp4
```

{% endcode %}

You can pass these URLs directly to PySDK models.

## Functions

`remote_assets.list_images() -> Dict[str, RemoteMedia]`

* Returns a mapping of attribute names (filename stems) to `RemoteMedia` objects for available JPG images.

`remote_assets.list_videos() -> Dict[str, RemoteMedia]`

* Returns a mapping of attribute names (filename stems) to `RemoteMedia` objects for available MP4 videos.

## Module Attributes

`remote_assets.<name> -> RemoteMedia`

* Dynamic attribute corresponding to an asset filename without extension.
* Returns a `RemoteMedia` (subclass of `str`) pointing to a stable HTTPS URL for the asset in PySDK Examples.

## RemoteMedia

`RemoteMedia` is a lightweight `str` subclass that adds simple media-type helpers while remaining usable anywhere a URL string is expected.

Attributes:

* `kind`: media kind as a string, one of `"image"`, `"video"`, or `"other"`.
* `is_image`: `True` if the asset is an image.
* `is_video`: `True` if the asset is a video.

Example:

{% code overflow="wrap" %}

```python
from degirum_tools import remote_assets

cat = remote_assets.cat  # RemoteMedia (string URL with helpers)
print(cat)               # prints the URL
print(cat.kind)          # "image"
print(cat.is_image)      # True
print(cat.is_video)      # False

vid = remote_assets.walking_people
print(vid.kind)          # "video"
```

{% endcode %}

Example output:

{% code overflow="wrap" %}

```
https://raw.githubusercontent.com/DeGirum/PySDKExamples/main/images/Cat.jpg
image
True
False
video
```

{% endcode %}
