Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -20,9 +20,6 @@ output_module1 = gr.outputs.Textbox(label = "Predicted Digit")
|
|
20 |
output_module2 = gr.outputs.Image(label = "Predicted Probability per class")
|
21 |
|
22 |
def image_classification(input1, input2):
|
23 |
-
print(input1.shape)
|
24 |
-
print(input2)
|
25 |
-
|
26 |
image = input1.reshape(1, 28 *28)
|
27 |
X_train = x_train.reshape(60000, 28*28)
|
28 |
X_test = x_test.reshape(10000, 28*28)
|
@@ -32,8 +29,8 @@ def image_classification(input1, input2):
|
|
32 |
|
33 |
y_test_predicted_label = kNN_classifier.predict(image)
|
34 |
|
35 |
-
output1 = y_test_predicted_label# text output example
|
36 |
-
output2 =
|
37 |
return output1,output2
|
38 |
|
39 |
# Step 6.4: Put all three component together into the gradio's interface function
|
|
|
20 |
output_module2 = gr.outputs.Image(label = "Predicted Probability per class")
|
21 |
|
22 |
def image_classification(input1, input2):
|
|
|
|
|
|
|
23 |
image = input1.reshape(1, 28 *28)
|
24 |
X_train = x_train.reshape(60000, 28*28)
|
25 |
X_test = x_test.reshape(10000, 28*28)
|
|
|
29 |
|
30 |
y_test_predicted_label = kNN_classifier.predict(image)
|
31 |
|
32 |
+
output1 = y_test_predicted_label[0]# text output example
|
33 |
+
output2 = y_test_predicted_label[1:5] # image-like array output example
|
34 |
return output1,output2
|
35 |
|
36 |
# Step 6.4: Put all three component together into the gradio's interface function
|