MuskanMjn commited on
Commit
942aa99
·
1 Parent(s): baedbad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -39,9 +39,7 @@ with gr.Blocks() as demo:
39
  with gr.Row():
40
  weights = gr.Radio(['uniform', "distance"], label="Weights", info="Choose the weight function")
41
  n_neighbors = gr.Slider(label="Neighbors", info="Choose the number of neighbors", minimum =1, maximum=15, step=1)
42
-
43
- btn = gr.Button(value="Submit")
44
-
45
 
46
  with gr.Row().style(equal_height=True):
47
  with gr.Column(scale=2):
@@ -50,7 +48,8 @@ with gr.Blocks() as demo:
50
  num = gr.Textbox(label="Test Accuracy")
51
 
52
 
53
- btn.click(train_and_plot, inputs=[weights, n_neighbors], outputs=[plot, num])
 
54
 
55
 
56
  if __name__ == "__main__":
 
39
  with gr.Row():
40
  weights = gr.Radio(['uniform', "distance"], label="Weights", info="Choose the weight function")
41
  n_neighbors = gr.Slider(label="Neighbors", info="Choose the number of neighbors", minimum =1, maximum=15, step=1)
42
+
 
 
43
 
44
  with gr.Row().style(equal_height=True):
45
  with gr.Column(scale=2):
 
48
  num = gr.Textbox(label="Test Accuracy")
49
 
50
 
51
+ weights.change(train_and_plot, inputs=[weights, n_neighbors], outputs=[plot, num])
52
+ n_neighbors.change(train_and_plot, inputs=[weights, n_neighbors], outputs=[plot, num])
53
 
54
 
55
  if __name__ == "__main__":