EduardoPacheco commited on
Commit
db438bf
·
1 Parent(s): c820b57

Event listener

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -138,7 +138,6 @@ with gr.Blocks() as demo:
138
  n_estimators = gr.inputs.Slider(minimum=1, maximum=100, step=1, default=10, label="Number of Estimators")
139
  max_depth = gr.inputs.Slider(minimum=1, maximum=100, step=1, default=3, label="Max Depth")
140
  random_state = gr.inputs.Slider(minimum=0, maximum=100, step=1, default=0, label="Random State")
141
- btn = gr.Button(label="Run")
142
  with gr.Row():
143
  plot1 = gr.Plot(label="Origianl Data")
144
  plot2 = gr.Plot(label="Truncated Date")
@@ -146,7 +145,11 @@ with gr.Blocks() as demo:
146
  plot3 = gr.Plot(label="Naive Bayes Decision Boundary")
147
  plot4 = gr.Plot(label="Extra Trees Decision Boundary")
148
 
149
- btn.click(app_fn, outputs=[plot1, plot2, plot3, plot4], inputs=[factor, random_state, noise, n_estimators, max_depth])
 
 
 
 
150
  demo.load(app_fn, inputs=[factor, random_state, noise, n_estimators, max_depth], outputs=[plot1, plot2, plot3, plot4])
151
 
152
  demo.launch()
 
138
  n_estimators = gr.inputs.Slider(minimum=1, maximum=100, step=1, default=10, label="Number of Estimators")
139
  max_depth = gr.inputs.Slider(minimum=1, maximum=100, step=1, default=3, label="Max Depth")
140
  random_state = gr.inputs.Slider(minimum=0, maximum=100, step=1, default=0, label="Random State")
 
141
  with gr.Row():
142
  plot1 = gr.Plot(label="Origianl Data")
143
  plot2 = gr.Plot(label="Truncated Date")
 
145
  plot3 = gr.Plot(label="Naive Bayes Decision Boundary")
146
  plot4 = gr.Plot(label="Extra Trees Decision Boundary")
147
 
148
+ factor.change(app_fn, outputs=[plot1, plot2, plot3, plot4], inputs=[factor, random_state, noise, n_estimators, max_depth])
149
+ noise.change(app_fn, outputs=[plot1, plot2, plot3, plot4], inputs=[factor, random_state, noise, n_estimators, max_depth])
150
+ n_estimators.change(app_fn, outputs=[plot1, plot2, plot3, plot4], inputs=[factor, random_state, noise, n_estimators, max_depth])
151
+ max_depth.change(app_fn, outputs=[plot1, plot2, plot3, plot4], inputs=[factor, random_state, noise, n_estimators, max_depth])
152
+ random_state.change(app_fn, outputs=[plot1, plot2, plot3, plot4], inputs=[factor, random_state, noise, n_estimators, max_depth])
153
  demo.load(app_fn, inputs=[factor, random_state, noise, n_estimators, max_depth], outputs=[plot1, plot2, plot3, plot4])
154
 
155
  demo.launch()