suryadev1 commited on
Commit
f9aba63
·
1 Parent(s): 8fa7cdc

changed for user input

Browse files
Files changed (1) hide show
  1. app.py +8 -3
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
- input_data = np.array(input_data).reshape(1, -1)
 
 
 
 
 
17
  # Make predictions
18
- predictions = knn.predict([[0.2,0.03,0.0,1.0,0.0]])
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