peekml.yaml

An optional file that describes your model's page: its title and description, and the form fields and outputs people see. It uses the same style as an OpenAPI schema.

Full example

info:
  title: Loan approval
  description: >
    Predicts whether a loan is approved from the applicant's details.

inputs:
  properties:
    age:
      type: number
      minimum: 18
      maximum: 100
      description: Age in years
    education:
      type: string
      enum: [high_school, bachelors, masters, phd]
    threshold:
      type: number
      minimum: 0
      maximum: 1
      multipleOf: 0.01
      x-widget: slider

outputs:
  properties:
    label:
      type: string
      enum: [approved, rejected]
    probabilities:
      type: array
      x-classes: [approved, rejected]

examples:
  - [42, "masters", 0.5]
  - [23, bachelors, 0.7]

The four sections

SectionWhat it holds
infotitle (required): the page heading and the model's web address, e.g. /your-username/loan-approval. description (optional): shown under the title; the > lets it run over several lines.
inputsOne entry per model input. See Inputs.
outputsThe outputs to show. See Outputs.
examplesOptional ready-made inputs, shown as “Try an example” buttons. See Examples below.

Names under inputs and outputs must match the model's input and output names exactly. Keys starting with x- are PeekML additions, the same way OpenAPI allows extensions.

Examples

Visitors often don't know what to type. Add up to five examples and each one becomes a button above the form (Example 1, Example 2, …): one click fills in the values and shows the prediction.

Each example matches your model's inputs. With several inputs, it's a list of their values in the same order as the inputs above: in the full example, [42, "masters", 0.5] means age 42, education masters, threshold 0.5. Quotes around text are optional in YAML, so [42, masters, 0.5] works too. With one input, it's just that value, without [ ]:

examples:
  - 42

Every input needs a value, and each value must fit its input: within minimum/maximum, and one of the enum values for dropdowns. On your model's page, View shows each example on one line as a Python list, with text in quotes, and you can edit it there as text.

Pictures

For a picture input, the example is a public link to the picture. The easiest place for it is your model's GitHub repository: open the picture on GitHub and copy the link from the address bar.

examples:
  - https://github.com/you/digit-reader/blob/main/samples/seven.png
  - https://github.com/you/digit-reader/blob/main/samples/three.png

When you publish or save, PeekML downloads each picture once and keeps a copy, so the button keeps working even if the file later moves. Pictures must be PNG, JPEG, GIF or WebP, up to 2 MB, and count towards your storage. The link must open without logging in (for GitHub, the repository must be public). To change a picture, change its link and save.

PeekML runs every example when you publish, so a broken one is caught before anyone sees it. Examples that show different answers (approved and rejected, or each class) make the best demo.

Schema

The exact format is published as a JSON Schema: peekml.schema.json. Editors can use it to suggest keys and point out mistakes while you type. In VS Code (with the YAML extension), add this as the first line of your file:

# yaml-language-server: $schema=https://peekml.io/peekml.schema.json

Don't have one?

Upload just the model. PeekML creates a starter peekml.yaml from it: the title from the file name, number boxes for numbers, text boxes for text, and every output shown as it is. Choose View on your model's page to inspect its metadata, then click the pencil icon to edit the fields and save your changes.