Logging Media
Simpcat supports logging audio and image media alongside scalar metrics. Media is uploaded to object storage and displayed in the web UI’s media panel.
Wrap audio data in simpcat.Audio and pass it to log():
import numpy as npimport simpcat
run = simpcat.init(project="tts")
# From a numpy array (float32, -1 to 1)audio = np.random.randn(22050).astype(np.float32) # 1 second at 22050 Hzsimpcat.log({"sample": simpcat.Audio(audio, sample_rate=22050, caption="generated")})
# From a file pathsimpcat.log({"reference": simpcat.Audio("/path/to/audio.wav", caption="ground truth")})Parameters
Section titled “Parameters”data_or_path—np.ndarray(float32 waveform) orstr(path to WAV file)caption— Optional caption displayed in the UI (default:"")sample_rate— Sample rate in Hz (default:22050)
Images
Section titled “Images”Wrap image data in simpcat.Image:
import numpy as npimport simpcat
run = simpcat.init(project="vision")
# From a numpy array (HWC uint8 or float 0-1)img = np.random.randint(0, 255, (256, 256, 3), dtype=np.uint8)simpcat.log({"prediction": simpcat.Image(img, caption="epoch 5")})
# From a PIL Imagefrom PIL import Image as PILImagepil_img = PILImage.open("result.png")simpcat.log({"output": simpcat.Image(pil_img)})
# From a file pathsimpcat.log({"input": simpcat.Image("/path/to/image.png")})Parameters
Section titled “Parameters”data_or_path—np.ndarray, PILImage, orstr(path to image file)caption— Optional caption displayed in the UI
Logging multiple media per step
Section titled “Logging multiple media per step”Pass a list of media objects under the same key:
samples = [simpcat.Audio(wav, sample_rate=22050) for wav in batch_outputs]simpcat.log({"samples": samples})Each item is uploaded separately and displayed as a gallery in the media panel.