Skip to content

datalpia/modelship

Repository files navigation

🚢 modelship

Ship machine learning models in minutes, not months

PyPI Python Versions CI/CD 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:

Features

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

Installation

Using pip (or any other Python package manager):

pip install modelship

Using uvx:

uvx modelship

Usage

Model metadata

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

Here is the YAML schema:

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):

$ 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

Copyright (c) 2025 - present Romain Clement / Datalpia

About

Ship machine learning models in minutes, not months

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •