The output of the application is defined by the function passed to dstack.app()
. See the function get_chart
in the following example:
from datetime import datetime, timedeltaimport dstack.controls as ctrlimport dstack as dsimport plotly.graph_objects as goimport pandas_datareader.data as webdef get_chart(symbols: ctrl.ComboBox):start = datetime.today() - timedelta(days=30)end = datetime.today()df = web.DataReader(symbols.value(), 'yahoo', start, end)fig = go.Figure(data=[go.Candlestick(x=df.index, open=df['Open'], high=df['High'], low=df['Low'], close=df['Close'])])return figapp = ds.app(get_chart, symbols=ctrl.ComboBox(["FB", "AMZN", "AAPL", "NFLX", "GOOG"]))result = ds.push("faang", app)print(result.url)
Within such a function, it's allowed to return a single object of the type that is supported. The supported base types include:
pandas.core.generic.NDFrame
(a Pandas dataframe)
plotly.graph_objs._figure.Figure
(a Plotly figure)
matplotlib.figure.Figure
(a Matplotlib figure)
bokeh.plotting.Figure
(a Bokeh figure)
dstack.markdown.Markdown
(a Markdown text, can be created via dstack.md()
)
Given the supported base types, it's possible to use Pandas
, Plotly
, Bokeh
, Matplotlib
, and Seaborn
for the output of the application. If you'd like to use something else as an output, please file an issue to the tracker.
Note, currently, it's not allowed to return multiple outputs. Please upvote the corresponding issue in the tracker.