Thanks to visit codestin.com
Credit goes to github.com

Skip to content

elbakerino/baistro

Repository files navigation

baistro · AI APIs

Github actions Build

Some APIs around AI models.

  • CPU only docker setup
  • Expects preloaded models, no (annoying) auto-downloads
  • Stats about token usage (partially/WIP)
  • Automatic OpenAPI generation

Tasks & Models

Vector Space Representations

by Sentence-Transformers

  • Text / Sentences
  • Image
  • Code

Linguistic Analysis

by Stanza

  • Locale Identification
  • Sentence Segmentation
  • Token Classification (NER, POS, MWT)
  • Sequence Classification (Sentiment)
  • Lemmatization

Task Implementations

  • Semantic Search
  • WIP Sentence Clustering

Usage

Clone this repository or add the service to your docker-compose.yml:

services:
    baistro:
        image: ghcr.io/elbakerino/baistro:0.4.0
        stop_signal: SIGINT
        environment:
            PORT: 8702
            GUN_W: 1
        volumes:
            # folder for model files
            - ./model-assets:/app/model-assets
        ports:
            - "8702:8702"

Startup server:

docker compose up

Run CLI in docker container:

# build container before using cli (if never `up`ed before)
docker compose build baistro

# open shell in container:
docker compose run --rm baistro bash

# run cli help:
poetry run cli

# download models:
poetry run cli download

# download model `stanza-multilingual` directly:
poetry run cli download stanza-multilingual

# list models:
poetry run cli models

# generate openapi spec file:
poetry run flask --app baistro.server:app spec -f yaml

Configure the vector models via env variables for each specialization:

MODEL__VECTOR_TEXT=T-Systems-onsite/cross-en-de-roberta-sentence-transformer
MODEL__VECTOR_CODE=microsoft/unixcoder-base
MODEL__VECTOR_IMAGE=sentence-transformers/clip-ViT-B-32-multilingual-v1
  • for models on huggingface: use its name then run e.g. poetry run cli download vector-text to download the new configured model
  • for custom model: mount the model folder as /app/model-assets/<custom-model>, with custom-model being the env-var value

DEV Notes

Manage dependencies with poetry v2:

# first update lock file if .toml was changed
poetry lock --regenerate
# then sync and install
poetry sync
poetry install

# poetry lock --regenerate && poetry sync && poetry install

License

This project is distributed as free software under the MIT License, see License.

© 2025 Michael Becker https://i-am-digital.eu

About

Some APIs around AI models, for NLP, with docker image.

Topics

Resources

License

Stars

Watchers

Forks

Packages