EduardoPacheco commited on
Commit
a9ffd34
1 Parent(s): b202b1b

Event listener

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -87,7 +87,6 @@ with gr.Blocks(title=title) as demo:
87
  n_estimators = gr.inputs.Slider(5, 150, 5, default=100, label="Number of Trees")
88
  min_samples_leaf = gr.inputs.Slider(1, 30, 5, default=1, label="Minimum number of samples to create a leaf")
89
 
90
- btn = gr.Button(label="Run")
91
 
92
  fig_mdi = gr.Plot(label="Mean Decrease Impurity (MDI)")
93
 
@@ -95,7 +94,10 @@ with gr.Blocks(title=title) as demo:
95
  fig_perm_train = gr.Plot(label="Permutation Importance (Train)")
96
  fig_perm_test = gr.Plot(label="Permutation Importance (Test)")
97
 
98
- btn.click(fn=app_fn, outputs=[fig_mdi, fig_perm_train, fig_perm_test], inputs=[seed, n_cat, n_estimators, min_samples_leaf])
 
 
 
99
  demo.load(fn=app_fn, outputs=[fig_mdi, fig_perm_train, fig_perm_test], inputs=[seed, n_cat, n_estimators, min_samples_leaf])
100
 
101
  demo.launch()
 
87
  n_estimators = gr.inputs.Slider(5, 150, 5, default=100, label="Number of Trees")
88
  min_samples_leaf = gr.inputs.Slider(1, 30, 5, default=1, label="Minimum number of samples to create a leaf")
89
 
 
90
 
91
  fig_mdi = gr.Plot(label="Mean Decrease Impurity (MDI)")
92
 
 
94
  fig_perm_train = gr.Plot(label="Permutation Importance (Train)")
95
  fig_perm_test = gr.Plot(label="Permutation Importance (Test)")
96
 
97
+ seed.change(fn=app_fn, outputs=[fig_mdi, fig_perm_train, fig_perm_test], inputs=[seed, n_cat, n_estimators, min_samples_leaf])
98
+ n_cat.change(fn=app_fn, outputs=[fig_mdi, fig_perm_train, fig_perm_test], inputs=[seed, n_cat, n_estimators, min_samples_leaf])
99
+ n_estimators.change(fn=app_fn, outputs=[fig_mdi, fig_perm_train, fig_perm_test], inputs=[seed, n_cat, n_estimators, min_samples_leaf])
100
+ min_samples_leaf.change(fn=app_fn, outputs=[fig_mdi, fig_perm_train, fig_perm_test], inputs=[seed, n_cat, n_estimators, min_samples_leaf])
101
  demo.load(fn=app_fn, outputs=[fig_mdi, fig_perm_train, fig_perm_test], inputs=[seed, n_cat, n_estimators, min_samples_leaf])
102
 
103
  demo.launch()