Remove incorrect "template" information (#13911)
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
This commit is contained in:
parent
2e59c49592
commit
1745d192f9
|
@ -58,64 +58,3 @@ Run the Lightning App on the cloud:
|
|||
.. code:: bash
|
||||
|
||||
lightning run app app.py --cloud
|
||||
|
||||
----
|
||||
|
||||
*************************************
|
||||
Build a Lightning App from a template
|
||||
*************************************
|
||||
If you didn't find an Lightning App similar to the one you need (in the `Lightning App gallery <https://lightning.ai/apps>`_), another option is to start from a template.
|
||||
The Lightning CLI can generate a template with built-in testing that can be easily published to the
|
||||
Lightning App Gallery.
|
||||
|
||||
Generate a Lightning App with our template generator:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
lightning init app your-app-name
|
||||
|
||||
You'll see a print-out like this:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
➜ lightning init app your-app-name
|
||||
|
||||
/Users/Your/Current/dir/your-app-name
|
||||
INFO: laying out app template at /Users/Your/Current/dir/your-app-name
|
||||
INFO:
|
||||
Lightning app template created!
|
||||
/Users/Your/Current/dir/your-app-name
|
||||
|
||||
run your app with:
|
||||
lightning run app your-app-name/app.py
|
||||
|
||||
run it on the cloud to share with your collaborators:
|
||||
lightning run app your-app-name/app.py --cloud
|
||||
|
||||
----
|
||||
|
||||
Modify the Lightning App template
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
The command above generates a Lightning App file like this:
|
||||
|
||||
.. code:: python
|
||||
|
||||
from your_app_name import ComponentA, ComponentB
|
||||
|
||||
import lightning as L
|
||||
|
||||
|
||||
class LitApp(L.LightningFlow):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.component_a = ComponentA()
|
||||
self.component_b = ComponentB()
|
||||
|
||||
def run(self):
|
||||
self.component_a.run()
|
||||
self.component_b.run()
|
||||
|
||||
|
||||
app = L.LightningApp(LitApp())
|
||||
|
||||
Now you can add your own components as you wish!
|
||||
|
|
|
@ -151,50 +151,3 @@ run the app
|
|||
.. code:: bash
|
||||
|
||||
lightning run app app.py
|
||||
|
||||
----
|
||||
|
||||
*******************************************
|
||||
Build a Lightning component from a template
|
||||
*******************************************
|
||||
If you'd prefer a component template with built-in testing that can be easily published to the
|
||||
Lightning component gallery, generate it with our template generator:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
lightning init component your-component-name
|
||||
|
||||
You'll see a print-out like this:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
➜ lightning init component your-component-name
|
||||
INFO: laying out component template at /Users/williamfalcon/Developer/opensource/_/lightning/scratch/hello-world
|
||||
INFO:
|
||||
⚡ Lightning component template created! ⚡
|
||||
/Users/williamfalcon/Developer/opensource/_/lightning/scratch/hello-world
|
||||
|
||||
...
|
||||
|
||||
----
|
||||
|
||||
Modify the component template
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
The command above generates a component file like this:
|
||||
|
||||
.. code:: python
|
||||
|
||||
import lightning as L
|
||||
|
||||
|
||||
class TemplateComponent(L.LightningWork):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.value = 0
|
||||
|
||||
def run(self):
|
||||
self.value += 1
|
||||
print("welcome to your work component")
|
||||
print("this is running inside a work")
|
||||
|
||||
Now you can modify the component as you wish!
|
||||
|
|
Loading…
Reference in New Issue