Show externally tracked images/video in app ui

Hi, I was wondering if it’s possible to show an externally tracked image file (from https, s3, gcs, etc.) in the app web UI.
Ideally, it would show up as a image panel in the panel bank, just like when logging a regular wandb.Image.
The doc page on tracking external artifacts (link below) says something about rendering external images/audio/video in the app UI, which makes it sound like it should be possible.

Thank you!

Hi @liamjwang , can you tell us more about your experiment or specific use case so we could understand better the inquiry. Thanks~

Hi @joana-marie, thanks for the reply. I have a model that logs an image on every step to an AWS bucket with public read-only access. If possible, I would like to view these images in the wandb UI without uploading the images to my wandb storage.

If I log an image the usual way with a wandb.Image(), it would be uploaded to the wandb storage instead of showing the image from the AWS bucket url.

There is a section in the documentation about tracking external files. I understand how to log external artifacts, but (image) artifacts aren’t rendered in the App UI.

This quote from the “track external files” documentation seems to suggest that rich media like images/audio/video can be rendered in the App UI somehow if the bucket is properly configured:

Rich media such as images, audio, video, and point clouds may fail to render in the App UI depending on the CORS configuration of your bucket. Allow listing app.wandb.ai in your bucket’s CORS settings will allow the App UI to properly render such rich media.

I can allow app.wandb.ai in the CORS settings of my bucket, but even still I don’t think the wandb app UI will attempt to render an image artifact.
So, I’m wondering if there’s example code that shows how to “render rich media in the App UI from an external bucket” like this documentation describes.

Thank you!

Hello @liamjwang

Thank you for clarifying, could you please try the following code:

import os
import wandb
import numpy as np
from PIL import Image as PILImage

run = wandb.init(project="project-name")
image_paths = ["URL_1","UR;_2"]

# Log images
for i, img_path in enumerate(image_paths):
    # Read the image file
    image = PILImage.open(img_path)
    
    # Convert the image to a numpy array if needed
    image_array = np.array(image)
    
    # Log the image to wandb
    wandb.log({f"image_{i}": [wandb.Image(image_array, caption=f"Image {i}")]})


wandb.finish()