Skip to content

快速入门

在5分钟内安装并运行Potato。

快速入门

只需几个步骤即可运行Potato。本指南将帮助您在5分钟内开始标注数据。

前提条件

  • Python 3.7 或更高版本
  • pip 包管理器

安装

使用 pip 安装 Potato:

bash
pip install potato-annotation

创建您的第一个项目

1. 创建项目目录

bash
mkdir my-annotation-task
cd my-annotation-task

2. 创建数据文件

创建一个 data 文件夹,并添加一个名为 data.json 的文件,其中包含您要标注的数据:

bash
mkdir data
json
[
  {"id": "1", "text": "I love this product! It's amazing."},
  {"id": "2", "text": "This is the worst experience ever."},
  {"id": "3", "text": "It's okay, nothing special."}
]

3. 创建配置文件

在项目目录中创建一个名为 config.yaml 的文件:

重要提示:配置文件必须位于项目目录内。这是 Potato 2.0 的安全要求。

yaml
port: 8000
server_name: localhost
task_name: "Sentiment Analysis"
 
# Task directory (current directory)
task_dir: "."
 
# Data configuration
data_files:
  - "data/data.json"
 
item_properties:
  id_key: id
  text_key: text
 
# Output configuration
output_annotation_dir: "output/"
output_annotation_format: "json"
 
# Annotation scheme
annotation_schemes:
  - annotation_type: radio
    name: sentiment
    description: "What is the sentiment of this text?"
    labels:
      - Positive
      - Negative
      - Neutral
 
# Allow anyone to annotate
allow_all_users: true

4. 启动服务器

bash
python -m potato start config.yaml -p 8000

或使用简写命令:

bash
potato start config.yaml

5. 打开浏览器

访问 http://localhost:8000 即可开始标注!

项目结构

您的项目应如下所示:

text
my-annotation-task/
├── config.yaml
├── data/
│   └── data.json
└── output/          # Created automatically
    └── annotations.json

下一步

工具与实用程序

当您熟悉基础知识后,请查看以下实用工具: