GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Azure/InferenceSchema: Schema decoration for inference code

This repository was archived by the owner on Jun 15, 2026. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

123 Commits
123 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
inference_schema
inference_schema
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
CODEOWNERS
CODEOWNERS
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.MD
CONTRIBUTING.MD
 
 
LICENSE.txt
LICENSE.txt
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
setup.py
setup.py
 
 

Repository files navigation

Integration Build

InferenceSchema

This Python package is intended to provide a uniform schema for common machine learning applications, as well as a set of decorators that can be used to aid in web based ML prediction applications.

Features

Function Decorators

The input and output decorators offered by this package are design to simplify the process of prediction in a web based application. They each provide support for schema generation based on a provided sample input, with the idea being that this schema can then be taken and embedded into an API Swagger specification. Additionally, the input decorator provides support for type conversion at runtime from a JSON based input into the user specified sample type, to allow for easy conversion of input over the wire into the datatype that the decorated function expects. These decorators can be nested with each other and with other decorators as desired.

Schema Generation

The package provides support for generating schema based on example input provided to the input and output decorators. This is intended to introduce a uniform conversion between a JSON format that can be embedded into a swagger specification and the in memory Python objects which may or may not have a built-in JSON representation. Currently it only supports OpenAPI 2.x

Type Conversion

The input decorator provides support to convert input that is passed to the decorated function from a JSON type into the type specified by the provided sample. This allows the function to be called in a web based manner without needing to convert the data from over the wire either prior to the function call or as a part of the function handling. If the provided input is already of the sample type, the decorator is a no-op. Each currently supported type offers options on how much conversion and input enforcement should be done at runtime. Currently the output decorator does no form of type conversion.

Supported Types

Currently the package supports generation for Numpy, Pandas, and Spark types, as well as standard Python types. These types are defined here. Custom types can be implemented by extending the AbstractParameterType and overriding the deserialize_input and input_to_swagger methods. It also supports nested dict or list inputs in case detailed description inside or data type conversion is desired. The item inside dict or list will be treated as a valid parameter if and only if they are of subtype of AbstractParameterType, which is an iterative definition.

Samples

Some sample usage for the decorators and each of the supported types can be found in the test resources.

Installing

This package is available for install via PyPi. The package supports dependency install via pip extras, so as to not bloat the user environment. Currently available extras are 'numpy-support', 'pandas-support', and 'spark-support'.

Contributing

This project follows the Microsoft standard contribution guidelines. More information can be found here.

In order to work on this project, you will need a working Python 3 environment (virtualenv recommended). Package dependencies are specified in setup.py, as well as package extras. These extras are defined separately to allow users to install only the packages they want, to not bloat their environment.

License

Please refer to LICENSE for package licensing information.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

About

Schema decoration for inference code

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

36 stars

Watchers

9 watching

Forks

14 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.