Spaces:
Sleeping
Sleeping
File size: 787 Bytes
4506582 15aa0b0 4506582 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import gradio as gr
from data import df # type: ignore
with gr.Blocks() as demo:
with gr.Row():
origin = gr.Dropdown(["All", "DFW", "DAL", "HOU"], value="All", label="Origin")
destination = gr.Dropdown(["All", "JFK", "LGA", "EWR"], value="All", label="Destination")
max_price = gr.Slider(0, 1000, value=1000, label="Max Price")
def filtered_data(origin, destination, max_price):
_df = df[df["price"] <= max_price]
if origin != "All":
_df = _df[_df["origin"] == origin]
if destination != "All":
_df = _df[_df["destination"] == destination]
return _df
gr.ScatterPlot(filtered_data, x="time", y="price", inputs=[origin, destination, max_price])
if __name__ == "__main__":
demo.launch() |