Metadata-Version: 2.4
Name: modelship
Version: 0.1.0
Summary: Ship machine learning models in minutes, not months
License: Apache-2.0
License-File: LICENSE
Keywords: deployment,machine-learning,onnx,webassembly
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Other Audience
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development
Classifier: Topic :: Utilities
Requires-Python: <3.14,>=3.10
Requires-Dist: jinja2>=3
Requires-Dist: onnxruntime>=1
Requires-Dist: pydantic>=2
Requires-Dist: pyyaml>=6
Description-Content-Type: text/markdown

# 🚢 modelship

> Ship machine learning models in minutes, not months

[![PyPI](https://img.shields.io/pypi/v/modelship.svg)](https://pypi.org/project/modelship/)
[![Python Versions](https://img.shields.io/pypi/pyversions/modelship?logo=python&logoColor=white)](https://pypi.org/project/modelship/)
[![CI/CD](https://github.com/datalpia/modelship/actions/workflows/ci-cd.yml/badge.svg)](https://github.com/datalpia/modelship/actions/workflows/ci-cd.yml)
[![License](https://img.shields.io/github/license/datalpia/modelship)](https://github.com/datalpia/modelship/blob/main/LICENSE)

`modelship` is a utility application to ease wrapping and deploying machine learning models
by autogenerating applications, leveraging modern standards such as ONNX and WebAssembly.

## Demo

Examples of static web applications generated with `modelship` from ONNX models:

- `housing`: housing price prediction model (regression)
    - Live: https://datalpia.github.io/modelship/demo/housing/
    - Source: [demo/housing](demo/housing)
- `sentiment`: movie review sentiment analysis (binary classification)
    - Live: https://datalpia.github.io/modelship/demo/sentiment/
    - Source: [demo/sentiment](demo/sentiment)

## Features

- ONNX model support
- Generate a static web application with autogenerated form

## Installation

Using `pip` (or any other Python package manager):

```bash
pip install modelship
```

Using `uvx`:

```bash
uvx modelship
```

## Usage

### Model metadata

Every model must be described with some basic metadata for conversions to work properly.

Here is the YAML schema:

```yaml
name: Model Name
description: Model description
inputs:
  float_input:
    name: Float Input Name
    type: float32
    shape: [null, 1]
    min: 10
    max: 100
    step: 1
    default: 50
  string_input:
    name: String Input Name
    type: string
    shape: [null]
outputs:
  float_output:
    name: Float Output Name
    type: float32
    shape: [null, 1]
  string_output:
    name: String Output Name
    type: string
    shape: [null]
```

Input fields:
- `name`: `str`
- `type`: `Literal["float32", "string"]`
- `shape`: `list[int | None]`
- (optional) `min`: `float`
- (optional) `max`: `float`
- (optional) `step`: `float`
- (optional) `defaut`: `float | str`

Output fields:
- `name`: `str`
- `type`: `Literal["float32", "string"]`
- `shape`: `list[int | None]`

### Static web application generation

Provide an ONNX model with its YAML metadata description, and `modelship`
will generate a static web application with an autogenerated HTML form,
performing model inference using ONNX Runtime Web (WebAssembly):

```bash
$ modelship static --output dist --metadata model/metadata.yml model/model.onnx
```

The resulting static application in `dist` can now be deployed on any static
hosting provider (GitHub Pages, GitLab Pages, Cloudflare Pages, S3, Vercel)!

## License

Licensed under [Apache License 2.0](LICENSE)

Copyright (c) 2025 - present Romain Clement / Datalpia
