Skip to content

Quick Start

Get tobira running in 5 minutes.

Prerequisites

  • Python 3.9+
  • A trained spam classification model (or use one from HuggingFace Hub)

1. Install tobira

pip install tobira[serving,fasttext]

2. Start the API server

tobira serve --backend fasttext --model-path /path/to/model.bin

Or with a TOML configuration file:

tobira serve --config tobira.toml

Example tobira.toml:

[backend]
type = "fasttext"
model_path = "/var/lib/tobira/fasttext-spam.bin"

The server starts on http://127.0.0.1:8000 by default.

3. Test the API

curl -X POST http://127.0.0.1:8000/predict \
  -H "Content-Type: application/json" \
  -d '{"text": "Buy cheap watches now! Limited offer!"}'

Response:

{
  "label": "spam",
  "score": 0.95,
  "labels": {"spam": 0.95, "ham": 0.05}
}

4. Check health

curl http://127.0.0.1:8000/health
{"status": "ok"}

5. Set up your MTA

Choose your MTA integration guide:

Next Steps