Skip to content

Commit ffa93a7

Browse files
committed
Simplify template app
1 parent b2e58a0 commit ffa93a7

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

shiny/examples/template/app.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
1-
import matplotlib.pyplot as plt
2-
import numpy as np
31
from shiny import App, render, ui
42

5-
# Generate some random numbers
6-
data_x = np.random.standard_normal(400)
7-
data_y = np.random.standard_normal(400)
8-
93
app_ui = ui.page_fluid(
10-
ui.input_slider("n", "Number of points", min=10, max=400, value=50, step=10),
11-
ui.output_plot("scatter_plot"),
4+
ui.h2("Hello Shiny!"),
5+
ui.input_slider("n", "N", 0, 100, 20),
6+
ui.output_text_verbatim("txt"),
127
)
138

149

1510
def server(input, output, session):
1611
@output
17-
@render.plot
18-
def scatter_plot():
19-
return plt.scatter(data_x[: input.n()], data_y[: input.n()])
12+
@render.text
13+
def txt():
14+
return f"n*2 is {input.n() * 2}"
2015

2116

2217
app = App(app_ui, server)

0 commit comments

Comments
 (0)