semvec/pypi-packages huggingface dataset:
modelship 0.2.3
Ship machine learning models in minutes, not months
License: Apache-2.0
Requires Python: <3.15,>=3.10
Keywords: deployment, machine-learning, onnx, webassembly

# 🚢 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