annotate_faces: Code faces in the browser

View source: R/annotation.R

annotate_facesR Documentation

Code faces in the browser

Description

Starts the coding page of an annotation_task from R and opens it in the web browser. Each answer is saved in the task's results folder as soon as the coder gives it, so closing the browser or R loses nothing, and a coder who comes back continues where they stopped.

Usage

annotate_faces(
  task,
  coder = NULL,
  open = interactive(),
  port = NULL,
  inline = .te_in_notebook(),
  max_side = 640
)

Arguments

task

An annotation_task, or its folder.

coder

The coder id to start with. Default: the page asks.

open

Logical. Open the page in the web browser. Default is TRUE in an interactive session.

port

Port of the local server. Default is a free port chosen at random.

inline

Logical. Show the coding page inside the notebook, below the cell. Default is TRUE in a Jupyter notebook (Google Colab, JupyterLab, VS Code) and FALSE elsewhere.

max_side

Longest side, in pixels, of the pictures in a notebook page, which stores them in the notebook. Default 640.

Details

The page is served by R (with httpuv) on your own computer only (127.0.0.1), at an address with a random part, and keeps running while you use R. Coders press the number keys to answer, Enter for the next item, and Backspace to undo.

Coders on other computers can open page/index.html of the task from a copy of the folder instead. Their page keeps answers in that browser and ends with Export annotations; put the exported files in the task's results folder.

In a Jupyter notebook, including Google Colab, the coding page is shown below the cell instead (inline = TRUE, the default there), because a page served from R cannot be reached from a notebook running on another computer. Its Copy R code button gives a line such as answers <- read_annotations(task, "te-annotations:...") to run in a new cell. The line holds every answer given so far, so copy it again after more coding; keep the last one, as the answers are not saved in the task's results folder.

Value

Invisibly, the page: a list with its url and stop(), which stops the server. With inline = TRUE, invisibly, the path of the page as one self-contained file.

See Also

read_annotations, annotation_progress

Examples

## Not run: 
coding <- annotate_faces("annotation-round-1", coder = "C01")
annotation_progress("annotation-round-1")
coding$stop()

## End(Not run)


transforEmotion documentation built on Oct. 26, 2026, 5:07 p.m.