Comment on page

Pub/Sub Message Guide

Plainsight provides Google Pub/Sub as an option to send images to your pipeline as well as receive data as output.

Topic Setup

To set up a Pub/Sub topic for input/output, check out Google's Documentation on creating and using topics:
To use Pub/Sub for data input, you will need a Pull subscription to this topic that the pipeline will use to read data and a service account key with access to this topic. To set up a Pull subscription, see:

Pub/Sub Input Format

To publish image data to a pipeline, the image needs to hosted on a publicly available server. The URL must be accessible via web browser.
Publish a JSON message to a pub/sub topic using the following format:
"url": "<URL OF IMAGE>",
"id": "Name to identify this image"
where url is the URL of the image and id is the name of the request.
"url": "",
"id": "small dog"
Prediction data will be published as JSON messages to Pub/Sub in the following example format. Data returned will vary based on the processing performed in the pipeline.
"source": {
"type": "gcs",
"bucket": "test-bucket",
"prefix": "Test_Input/African_Animals/elephant",
"name": "elephant1.jpg",
"url": ""
"output": {
"predictions": [{
"rabbit": [{
"type": "rectangle",
"children": {},
"data": {
"min": [0.5289592361450195, 0.002057587477698255],
"max": [0.9354885864257813, 0.9894458144458372]
"score": 0.9424573183059692
"modelPath": "gs://plainsight-current-uploads/organizations/01FXRFS52CJTRS354JF1BDYSSN/models/01G8JDDMXWYXDK3R5WJ1G4F731/versions/01G8Y6T539116RDMWY6867M301/"
  • source - contains information about the input image.
  • output - contains:
    • output image as a base64-encoded string if "Include output images" was selected when this output destination was configured (or null otherwise), or if a transformation was performed
    • segmentation mask as a base64-encoded string (for Semantic Segmentation models)
    • prediction data (if applicable) including score and modelPath of the corresponding model