Toloka documentation

Image comparison (Side-by-side)

For this type of project, you can use the Image comparison (Side-by-side) preset.

Take a look at the example: there are two images and buttons to choose an answer. Note that validation, keyboard shortcuts, and task layout are already configured in this example.

Components used in the example
  • view.image: Image.

    Show code
    {
      "type": "view.image",
      "url": "https://tlk.s3.yandex.net/dataset/toloka_logos/b2b_dandelion_icon.png"
    }
    
  • layout.side-by-side: Arranges images side by side.

    Show code
    {
      "type": "layout.side-by-side",
      "items": [],
      "controls": {
        "type": "view.list",
        "items": []
      }
    }
    
  • field.radio-group: Buttons for answer options.

    Show code
    {
      "type": "field.radio-group",
      "label": "Which icon do you like more?",
      "options": [],
      "data": {
        "type": "data.output",
        "path": "result"
      },
      "validation": {
        "type": "condition.required"
      }
    }
    
  • condition.required: Checks if at least one option is selected.

    Show code
    {
      "type": "condition.required"
    }
    
  • plugin.hotkeys: Keyboard shortcuts.

    Show code
    {
      "1": {
        "type": "action.set",
        "data": {
          "type": "data.output",
          "path": "result"
        },
        "payload": "LEFT"
      },
      "2": {
        "type": "action.set",
        "data": {
          "type": "data.output",
          "path": "result"
        },
        "payload": "RIGHT"
      },
      "3": {
        "type": "action.set",
        "data": {
          "type": "data.output",
          "path": "result"
        },
        "payload": "404"
      },
      "type": "plugin.hotkeys"
    }
    

Note

You can add media files (audio files, videos, images) from your own server, Yandex Disk, or a cloud storage like Yandex Cloud, Google Cloud, or Amazon AWS.

What else can be configured

  • To add a detailed description to the task, use the view.text component.

    Show code
    {
      "type": "view.text",
      "content": "Look at the pictures and choose the one you like more."
    }
    

  • To let Tolokers leave comments about the task or their response, add a text field using field.textarea.

    Show code
    {
      "type": "field.textarea",
      "label": "Comments",
      "placeholder": "Enter text",
      "data": {
        "type": "data.output",
        "path": "comment"
      }
    }
    

If this preset doesn't meet your needs, see other examples in this section.

Add a layout

To enhance Toloker's experience, you can highlight different types of data with colors using view.alert. In this example, the source text is highlighted with a blue border, and the buttons are highlighted with a yellow one.

Show code
{
  "type": "view.alert",
  "theme": "info",
  "content": {
    "type": "view.text",
    "content": "Look at the pictures and choose the one you like more."
  }
},
{
  "type": "layout.side-by-side",
  "items": [],
  "controls": {
    "type": "view.alert",
    "theme": "warning",
    "content": {
      "type": "field.radio-group",
      "label": "Which icon do you like more?",
      "options": [],
      "data": {
        "type": "data.output",
        "path": "result"
      },
      "validation": {
        "type": "condition.required"
      }
    }
  }
}

See also