LenixC commited on
Commit
3179b53
·
1 Parent(s): e90417e

Converted button to event listeners.

Browse files
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -62,15 +62,19 @@ with gr.Blocks() as demo:
62
  with gr.Column():
63
  n_samp = gr.Slider(100, 1000, 200, step=1, label="Number of Samples")
64
  n_feat = gr.Slider(3, 100, 50, step=1, label="Number of Features")
65
- btn = gr.Button(label="Run")
66
  with gr.Column():
67
  scores = gr.Textbox(label="R2 Scores")
68
  coeff_comp_graph = gr.Plot(label="Comparison of Coefficients")
69
- btn.click(
70
- fn=compare_reg,
71
- inputs=[n_samp, n_feat],
72
- outputs=[coeff_comp_graph, scores]
73
- )
 
 
 
 
 
74
  with gr.Row():
75
  gr.Markdown("This shows a high degree of correlation between the the regression coefficients of OLS and NNLS. However, we observe that some coefficients in the NNLS regression shrink to 0.")
76
 
 
62
  with gr.Column():
63
  n_samp = gr.Slider(100, 1000, 200, step=1, label="Number of Samples")
64
  n_feat = gr.Slider(3, 100, 50, step=1, label="Number of Features")
 
65
  with gr.Column():
66
  scores = gr.Textbox(label="R2 Scores")
67
  coeff_comp_graph = gr.Plot(label="Comparison of Coefficients")
68
+ n_samp.change(
69
+ fn=compare_reg,
70
+ inputs=[n_samp, n_feat],
71
+ outputs=[coeff_comp_graph, scores]
72
+ )
73
+ n_feat.change(
74
+ fn=compare_reg,
75
+ inputs=[n_samp, n_feat],
76
+ outputs=[coeff_comp_graph, scores]
77
+ )
78
  with gr.Row():
79
  gr.Markdown("This shows a high degree of correlation between the the regression coefficients of OLS and NNLS. However, we observe that some coefficients in the NNLS regression shrink to 0.")
80