Let's create a simple web app that asks user for name and display greetings.
During notebook development you can interact with widget. Its value will be updated. However, you need to manually execute cells to see a change.
Cells are automatically re-executed when running notebook as Mercury App. Mercury re-execute cell with widget definition and cells below.
You will need
mercury package for this example.
import mercury as mr
name = mr.Text(value="Piotr", label="What is your name?")
Print widget value:
Cell 2 and 3 will be automatically re-executed after widget update when running as Mercury App.
Please save notebook as
hello-world.ipynb file. Mercury will set
hello-world as web app title.
If you want to set different title please check the
The screenshot of code in the Jupyter Notebook:
Please start Mercury with the following command:
Open web browser at address
http://127.0.0.1:8000, you will see your notebooks.
Please select card with your notebook. You can set name value and press
Enter to see a change.