I'm trying to learn the basics of Shiny for Python. When I looked at the most 'Basic App' example from the Posit website, and then created a python file in VS Code with this exact code, I was unable to see the output when I clicked run.
How do I make the output come up on my computer? I was expecting to see the same output that is available on the Posit website.
from shiny import App, render, ui
app_ui = ui.page_fluid(
ui.input_slider("n", "N", 0, 100, 20),
ui.output_text_verbatim("txt"),
)
def server(input, output, session):
@output
@render.text
def txt():
return f"n*2 is {input.n() * 2}"
app = App(app_ui, server)
You need
app.run()at the end to start the app:or