An application may have multiple tabs. Here's an example of a simple application with two tabs: "Scatter Chart"
and "Bar Chart"
:
import dstack as dsimport plotly.express as px# Create an instance of the applicationapp = ds.app()# Create a tabscatter_tab = app.tab("Scatter Chart")# Create an output with a chartscatter_tab.output(data=px.scatter(px.data.iris(), x="sepal_width", y="sepal_length", color="species"))# Create a tabbar_tab = app.tab("Bar Chart")# Create an output with a chartbar_tab.output(data=px.bar(px.data.tips(), x="sex", y="total_bill", color="smoker", barmode="group"))# Deploy the application with the name "tabs" and print its URLurl = app.deploy("tabs")print(url)
If you open the application, you'll see the following:
Live Demo:
https://dstack.cloud/gallery/tabs
When you invoke the dstack.Application.tab()
function, you get an instance of dstack.ApplicationBase
which has pretty much all functions that dstack.Application
has so you can change its layout, and add controls.
Check out the following tutorial that uses a bit more complex layouts within multiple tabs: