jiehou commited on
Commit
9fdee78
·
1 Parent(s): d859776

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -116,7 +116,7 @@ def KNN_predict(train_features, train_labels, test_feature, K):
116
  ### main function for gradio to call to classify image
117
  def call_our_KNN(test_image, K=7):
118
  test_image_flatten = test_image.reshape((-1, 28*28))
119
- y_pred_each, image_path = KNN_predict(train_features, train_labels, test_image_flatten, K)
120
  return y_pred_each, image_path
121
 
122
 
@@ -125,7 +125,7 @@ sample_images = get_sample_images(10)
125
 
126
  ### configure inputs/outputs
127
  set_image = gr.inputs.Image(shape=(28, 28), image_mode='L')
128
- set_K = gr.inputs.Slider(0, 24, default=7)
129
 
130
  set_label = gr.outputs.Textbox(label="Predicted Digit")
131
  set_out_images = gr.outputs.Image(label="Closest Neighbors")
 
116
  ### main function for gradio to call to classify image
117
  def call_our_KNN(test_image, K=7):
118
  test_image_flatten = test_image.reshape((-1, 28*28))
119
+ y_pred_each, image_path = KNN_predict(train_features, train_labels, test_image_flatten, int(K))
120
  return y_pred_each, image_path
121
 
122
 
 
125
 
126
  ### configure inputs/outputs
127
  set_image = gr.inputs.Image(shape=(28, 28), image_mode='L')
128
+ set_K = gr.inputs.Slider(0, 24, step=1, default=7)
129
 
130
  set_label = gr.outputs.Textbox(label="Predicted Digit")
131
  set_out_images = gr.outputs.Image(label="Closest Neighbors")