albertvillanova HF staff commited on
Commit
b2a0b3c
1 Parent(s): 5901238

Use blocks instead of interface

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -73,16 +73,15 @@ scheduler.add_job(update_datasets, trigger="cron", hour=0, minute=1, timezone=da
73
  scheduler.start()
74
 
75
 
76
- demo = gr.Interface(
77
- fn=filter_dataframe,
78
- inputs=[
79
- gr.Dropdown(choices=dates, label="Date from"),
80
- gr.Dropdown(choices=dates, label="Date to"),
81
- ],
82
- outputs=gr.Dataframe(
83
  headers=["Dataset", "Downloads"],
84
  datatype=["str", "number"],
85
  label="Created datasets",
86
- ),
87
- )
88
  demo.launch()
 
73
  scheduler.start()
74
 
75
 
76
+ with gr.Blocks() as demo:
77
+ with gr.Row():
78
+ date_from = gr.Dropdown(choices=dates, label="Date from")
79
+ date_to = gr.Dropdown(choices=dates, label="Date to")
80
+ submit_btn = gr.Button("Submit")
81
+ outputs = gr.Dataframe(
 
82
  headers=["Dataset", "Downloads"],
83
  datatype=["str", "number"],
84
  label="Created datasets",
85
+ )
86
+ submit_btn.click(fn=filter_dataframe, inputs=[date_from, date_to], outputs=outputs)
87
  demo.launch()