import asyncio
import panel as pn
import altair as alt
from vega_datasets import data
from panel.io.pyodide import show
from chart import get_chart
horse_power = pn.widgets.IntInput(value=230, step=1, start=0, end=230)
button = pn.widgets.Button(name='Filter', button_type='primary')
search = pn.Column('# Filter by Horsepower', horse_power, background='White')
cars = data.cars()
table = pn.widgets.Tabulator(pagination='remote', page_size=10)
table.value = cars
chart = pn.pane.Vega()
chart.object = get_chart(cars)
@pn.depends(horse_power, watch=True)
def update_ui(*events):
chart.object = get_chart(cars[cars['Horsepower'] < horse_power.value])
table.value = cars[cars['Horsepower'] < horse_power.value]
await show(search, 'search')
await show(chart, 'chart')
await show(table, 'table')