Deploy and access image and data processing models via HTTPS.
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?
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nahual-0.0.1.tar.gz.
File metadata
- Download URL: nahual-0.0.1.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.30
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
961bf42a6e82297764211f2dda07a3a000d7389beb365228aeb30ce7d3936d36
|
|
| MD5 |
ffa529913452b81db00862132ca7831f
|
|
| BLAKE2b-256 |
a2c022b6d48ee959278785f202ac3718fdfb0da0d756efbf9fb8a661608a851c
|
File details
Details for the file nahual-0.0.1-py3-none-any.whl.
File metadata
- Download URL: nahual-0.0.1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e842cc053b7c6cddb75310e128f5c9fd2fb77941f39a3735344cc7c69253bc0e
|
|
| MD5 |
d52a13c811997bb5401fc82f8f057e9f
|
|
| BLAKE2b-256 |
10f8266b370626710291bd3bdf17a37e29f79b128071811e6db83230b255a3de
|