Skip to content
此页面尚未提供您所选语言的版本,当前显示英文版本。

Lokale Entwicklung

Potato für lokale Entwicklung und Tests einrichten.

Lokale Entwicklung

Bringen Sie Potato auf Ihrem lokalen Rechner für Entwicklung und Tests zum Laufen.

Voraussetzungen

  • Python 3.7 oder höher
  • pip-Paketmanager
  • Git (optional, zum Klonen von Beispielen)

Installation

Mit pip (Empfohlen)

bash
pip install potato-annotation

Aus dem Quellcode

bash
git clone https://github.com/davidjurgens/potato.git
cd potato
pip install -e .

Mit optionalen Abhängigkeiten

bash
# For audio annotation support
pip install potato-annotation[audio]
 
# For all optional features
pip install potato-annotation[all]

Schnellstart

1. Konfigurationsdatei erstellen

Erstellen Sie config.yaml:

yaml
task_name: "My First Annotation Task"
 
server:
  port: 8000
 
data_files:
  - path: data.json
    text_field: text
 
annotation_schemes:
  - annotation_type: radio
    name: sentiment
    description: "What is the sentiment?"
    labels:
      - Positive
      - Negative
      - Neutral
 
output:
  path: annotations/

2. Beispieldaten vorbereiten

Erstellen Sie data.json:

json
[
  {"id": "1", "text": "I love this product!"},
  {"id": "2", "text": "This is terrible."},
  {"id": "3", "text": "It's okay, nothing special."}
]

3. Server starten

bash
potato start config.yaml

4. Auf die Oberfläche zugreifen

Öffnen Sie Ihren Browser unter http://localhost:8000

Entwicklungsmodus

Hot Reloading

Auto-Neustart bei Konfigurationsänderungen aktivieren:

bash
potato start config.yaml --reload

Debug-Modus

Detaillierte Protokollierung aktivieren:

bash
potato start config.yaml --debug

Ausführliche Ausgabe

Alle Serveraktivitäten anzeigen:

bash
potato start config.yaml --verbose

Verzeichnisstruktur

Empfohlenes Projektlayout:

text
my-annotation-project/
├── config.yaml           # Main configuration
├── data/
│   ├── train.json        # Training data
│   └── main.json         # Annotation data
├── annotations/          # Output directory
├── templates/            # Custom HTML templates
└── static/               # Custom CSS/JS

Konfiguration testen

Konfiguration validieren

Auf Syntaxfehler prüfen:

bash
potato validate config.yaml

Vorschaumodus

Ohne Annotationen zu speichern starten:

bash
potato start config.yaml --preview

Mit Beispieldaten testen

Testdaten generieren:

bash
potato generate-data --count 10 --output test_data.json

Häufige Probleme

Port bereits in Verwendung

bash
# Use a different port
potato start config.yaml --port 8080
 
# Or in config.yaml
server:
  port: 8080

Datendatei nicht gefunden

Stellen Sie sicher, dass Pfade relativ zum Speicherort der Konfigurationsdatei sind:

yaml
# If data is in subdirectory
data_files:
  - path: data/main.json
 
# Or use absolute path
data_files:
  - path: /full/path/to/data.json

Zugriff verweigert

Dateiberechtigungen prüfen:

bash
chmod 755 annotations/
chmod 644 data/*.json

Mehrere Benutzer lokal

Für das Testen von Mehrbenutzerszenarien:

yaml
allow_all_users: true
url_user_id_param: user_id

Mit verschiedenen Benutzern zugreifen:

  • http://localhost:8000/?user_id=annotator1
  • http://localhost:8000/?user_id=annotator2

Annotationen zurücksetzen

Alle Annotationen löschen und neu beginnen:

bash
# Remove annotation files
rm -rf annotations/*
 
# Restart server
potato start config.yaml

Umgebungsvariablen

Über die Umgebung konfigurieren:

bash
export POTATO_PORT=8000
export POTATO_DEBUG=true
export POTATO_DATA_PATH=/path/to/data
 
potato start config.yaml

Mit virtuellen Umgebungen verwenden

venv

bash
python -m venv potato-env
source potato-env/bin/activate  # Linux/Mac
potato-env\Scripts\activate     # Windows
pip install potato-annotation

Conda

bash
conda create -n potato python=3.10
conda activate potato
pip install potato-annotation

IDE-Integration

VS Code

Installieren Sie die YAML-Erweiterung für die Unterstützung von Konfigurationsdateien:

json
// settings.json
{
  "yaml.schemas": {
    "https://potato-annotation.com/schema.json": "config.yaml"
  }
}

PyCharm

Führen Sie eine Ausführungskonfiguration ein:

  1. Hinzufügen Python
  2. Skript: potato
  3. Parameter: start config.yaml
  4. Arbeitsverzeichnis: Ihr Projektpfad

Nächste Schritte