Skip to main content

Deploy and access image and data processing models across processes.

Project description

Nahual: Deploy and access image and data processing models across environments/processes.

Note that this is early work in progress.

This tool aims to provide a one-stop-shop source for multiple models to process imaging data or their derivatives. You can think of it as a much simpler ollama but for biological analyses, deep learning-based or otherwise.

Implemented tools

By default, the models and tools are deployable using Nix.

  • Baby: Segmentation, tracking and lineage assignment for budding yeast.

WIP tools

  • trackastra: Transformer-based models trained on a multitude of datasets.
  • DINOv2: Generalistic self-supervised model to obtain visual features.

Minimal example for FastAPI-based server+client

Any model requires a thin layer that communicates using [[https://github.com/nanomsg/nng][nng]].

This is the server side

import numpy
import orjson
from fastapi import FastAPI, Request, Response

app = FastAPI()

@app.post("/process")
async def process(request: Request):
    # Convert list to numpy array
    array = numpy.asarray(orjson.loads(await request.body()))
    # Example processing, here is where processing is performed
    result = array * 2
    return Response(
        orjson.dumps(result, option=orjson.OPT_SERIALIZE_NUMPY),
    )

This is the client side

import numpy
import orjson
import requests

# Serialize a numpy array using orjson (faster json serialization)
serial_numpy = orjson.dumps(
    numpy.array([[1, 2], [3, 4]]),
    option=orjson.OPT_SERIALIZE_NUMPY,
)
response = requests.post(
    "http://localhost:8000/process",
    serial_numpy,
)
print(orjson.loads(response.content))
# [[2, 4], [6, 8]]

Why nahual?

logo

In Mesoamerican folklore, a Nahual is a shaman able to transform into different animals.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nahual-0.0.2.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nahual-0.0.2-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file nahual-0.0.2.tar.gz.

File metadata

  • Download URL: nahual-0.0.2.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.30

File hashes

Hashes for nahual-0.0.2.tar.gz
Algorithm Hash digest
SHA256 a1c2bfcf2ff2bd3a1a8d7f9b3a52eb3343de0c4d99cd27db62251684eedde3c3
MD5 103db7e437e36cb00c0a04e5432ae141
BLAKE2b-256 14f806500655083019e1550f991783c5b417c55d3f05950adea98ab321fe473c

See more details on using hashes here.

File details

Details for the file nahual-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: nahual-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.30

File hashes

Hashes for nahual-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b5970a12d64d68739224bd422ef99b4e95cb2591825886ff7d98fecc6fa3b8a4
MD5 10c460589f3bae4c6b63d8fd9d63fa53
BLAKE2b-256 5215511561dd198017accf98a1a7393820b4a099392b811af2d59fb617c2c14c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page