Spaces:
Sleeping
Sleeping
changed for user input
Browse files
app.py
CHANGED
@@ -13,9 +13,14 @@ with open(model_path, 'rb') as f:
|
|
13 |
# Define the prediction function
|
14 |
def predict(input_data):
|
15 |
# Convert input_data to numpy array
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
17 |
# Make predictions
|
18 |
-
predictions = knn.predict([[
|
19 |
return predictions[0]
|
20 |
|
21 |
|
@@ -25,7 +30,7 @@ iface = gr.Interface(
|
|
25 |
inputs='text',
|
26 |
outputs='text',
|
27 |
title="KNN Model Prediction",
|
28 |
-
description="Enter values for each feature to get a prediction."
|
29 |
)
|
30 |
|
31 |
# Launch the interface
|
|
|
13 |
# Define the prediction function
|
14 |
def predict(input_data):
|
15 |
# Convert input_data to numpy array
|
16 |
+
input=input_data.split(' ')
|
17 |
+
first=float(input[0])
|
18 |
+
second=float(input[1])
|
19 |
+
third=float(input[2])
|
20 |
+
fourth=float(input[3])
|
21 |
+
fifth=float(input[4])
|
22 |
# Make predictions
|
23 |
+
predictions = knn.predict([[first,second,third,fourth,fifth]])
|
24 |
return predictions[0]
|
25 |
|
26 |
|
|
|
30 |
inputs='text',
|
31 |
outputs='text',
|
32 |
title="KNN Model Prediction",
|
33 |
+
description="Enter values for each feature with spaces to get a prediction."
|
34 |
)
|
35 |
|
36 |
# Launch the interface
|