docstr: The ModelInferenceAPI Class enables to easily get your model served.
  
  Arguments:
      input: Optional `input` to be provided. This would make provide a built-in deserializer.
      output: Optional `output` to be provided. This would make provide a built-in serializer.
      host: Address to be used to serve the model.
      port: Port to be used to serve the model.
      workers: Number of workers for the uvicorn. Warning, this won't work if your subclass takes more arguments.
docstr_tok: ["The","ModelInferenceAPI","Class","enables","to","easily","get","your","model","served",".","Arguments",":","input",":","Optional","`","input","`","to","be","provided",".","This","would","make","provide","a","built-in","deserializer",".","output",":","Optional","`","output","`","to","be","provided",".","This","would","make","provide","a","built-in","serializer",".","host",":","Address","to","be","used","to","serve","the","model",".","port",":","Port","to","be","used","to","serve","the","model",".","workers",":","Number","of","workers","for","the","uvicorn",".","Warning",",","this","wo","n't","work","if","your","subclass","takes","more","arguments","."]
code: def __init__(
      self,
      input: Optional[str] = None,
      output: Optional[str] = None,
      host: str = "127.0.0.1",
      port: int = 7777,
      workers: int = 0,
  ):
      """The ModelInferenceAPI Class enables to easily get your model served.
  
      Arguments:
          input: Optional `input` to be provided. This would make provide a built-in deserializer.
          output: Optional `output` to be provided. This would make provide a built-in serializer.
          host: Address to be used to serve the model.
          port: Port to be used to serve the model.
          workers: Number of workers for the uvicorn. Warning, this won't work if your subclass takes more arguments.
  
      """
      super().__init__(parallel=True, host=host, port=port)
      if input and input not in _DESERIALIZER:
          raise Exception(
              f"Only input in {_DESERIALIZER.keys()} are supported."
          )
      if output and output not in _SERIALIZER:
          raise Exception(
              f"Only output in {_SERIALIZER.keys()} are supported."
          )
      self.input = input
      self.output = output
      self.workers = workers
      self._model = None
  
      self.ready = False
  
imports: import abc
  import inspect
  import os
  import pydoc
  import subprocess
  import sys
  from typing import Any, Callable, Optional
  import fastapi
  import uvicorn
  from fastapi import FastAPI
  from fastapi.responses import JSONResponse
  from lightning.app.components.serve.types import _DESERIALIZER, _SERIALIZER
  from lightning.app.core.work import LightningWork
  from lightning.app.utilities.app_helpers import Logger
label_desc: Use image node_id 1 to create a new ModelInferenceAPI object from inherited base classes: LightningWork, abc with example: obj = ModelInferenceAPI(input, output, host, port, workers)