torchwebio package

Subpackages

Submodules

torchwebio.exceptions module

exception torchwebio.exceptions.BaseTorchWebioException[source]

Bases: Exception

Base exception of the library

exception torchwebio.exceptions.ComingSoonException(feature, error)[source]

Bases: BaseTorchWebioException

A special exception for features that are not yet implemented, but are planned

torchwebio.webalyzer module

class torchwebio.webalyzer.Model_Types(value)[source]

Bases: IntEnum

An enumeration.

IMAGE_MODEL = 1
NLP_MODEL = 2
torchwebio.webalyzer.image_class_webio(model: Module, title, subtitle, category_list=None)[source]

Implementation of a PyWebIO application for image classification models.

Accepts an image and outputs a table of classification scores.

Parameters
  • model (nn.Module) – Pytorch model that needs to do the prediction

  • title (_type_) – Title for the application

  • subtitle (_type_) – Subtitle for the application

  • category_list (_type_, optional) – URL to the category list to map categories indices to labels, by default None

torchwebio.webalyzer.webalyzer(model: Module, title: str = 'Image Classification', subtitle: str = 'Calculates classsification labels on ImageNet', model_type: Model_Types = Model_Types.IMAGE_MODEL, class_category_list: Optional[str] = None)[source]

Function to generate an application based on the model. Currently supports timm-like Image classification models Coming soon: NLP and more Computer vision model suppport

Parameters
  • model (nn.Module) – Pytorch model to be turned into an application

  • title (str, optional) – Title for the application, by default “Image Classification”

  • subtitle (str, optional) –

    Subtitle or body of the application, by default

    ”Calculates classsification labels on ImageNet”

  • model_type (Model_Types, optional) – Type of the model, by default Model_Types.IMAGE_MODEL

  • class_category_list (str, optional) – Mapping output vectors to class categories., by default None

Raises

ComingSoonException – If a non ImageModel Model_Types is passed, an exception is raised

Module contents