Skip to content

Commit

Permalink
[docs] Include all components in the API reference (#15805)
Browse files Browse the repository at this point in the history
* Update docs

Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
  • Loading branch information
akihironitta and Borda authored Dec 8, 2022
1 parent b8c7018 commit e6f4c84
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
8 changes: 8 additions & 0 deletions docs/source-app/api_references.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

----
Expand Down
24 changes: 12 additions & 12 deletions src/lightning_app/components/serve/python_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e6f4c84

Please sign in to comment.