diff --git a/docs/source-app/api_references.rst b/docs/source-app/api_references.rst index 2540633838502..2272f7bf13c41 100644 --- a/docs/source-app/api_references.rst +++ b/docs/source-app/api_references.rst @@ -32,11 +32,19 @@ ___________________ :nosignatures: :template: classtemplate_no_index.rst + ~database.client.DatabaseClient + ~database.server.Database ~python.popen.PopenPythonScript ~python.tracer.TracerPythonScript ~training.LightningTrainerScript ~serve.gradio.ServeGradio ~serve.serve.ModelInferenceAPI + ~serve.python_server.PythonServer + ~serve.streamlit.ServeStreamlit + ~multi_node.base.MultiNode + ~multi_node.lite.LiteMultiNode + ~multi_node.pytorch_spawn.PyTorchSpawnMultiNode + ~multi_node.trainer.LightningTrainerMultiNode ~auto_scaler.AutoScaler ---- diff --git a/src/lightning_app/components/serve/python_server.py b/src/lightning_app/components/serve/python_server.py index 99d51ac1cf4fc..209135e27f0c1 100644 --- a/src/lightning_app/components/serve/python_server.py +++ b/src/lightning_app/components/serve/python_server.py @@ -114,26 +114,26 @@ def __init__( # type: ignore The default data type is good enough for the basic usecases and it expects the data to be a json object that has one key called `payload` - ``` - input_data = {"payload": "some data"} - ``` + .. code-block:: python + + input_data = {"payload": "some data"} and this can be accessed as `request.payload` in the `predict` method. - ``` - def predict(self, request): - data = request.payload - ``` + .. code-block:: python + + def predict(self, request): + data = request.payload output_type: Optional `output_type` to be provided. This needs to be a pydantic BaseModel class. The default data type is good enough for the basic usecases. It expects the return value of the `predict` method to be a dictionary with one key called `prediction`. - ``` - def predict(self, request): - # some code - return {"prediction": "some data"} - ``` + .. code-block:: python + + def predict(self, request): + # some code + return {"prediction": "some data"} and this can be accessed as `response.json()["prediction"]` in the client if you are using requests library