Gallai commited on
Commit
c832be8
·
verified ·
1 Parent(s): 24f0b2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -7,17 +7,16 @@ import gradio as gr
7
  scaler = load('scaler_lab4.joblib')
8
  KNN_Regressor = load('knn_lab4.joblib')
9
 
 
10
  ## Building a Fubction for prediction:
11
 
12
  def predictPrice(input1, input2, input3, input4, input5, input6, input7, input8):
13
  features = np.array([[input1, input2, input3, input4, input5, input6, input7, input8]])
14
  features_scaled = scaler.transform(features)
15
  prediction = KNN_Regressor.predict(features_scaled)
16
- return prediction
17
-
18
-
19
-
20
 
 
21
  ## Buidling inputs and outputs:
22
 
23
  input1 = gr.Slider(-124.35, -114.31, step=5, label = "Longitude")
@@ -35,4 +34,4 @@ output1 = gr.Textbox(label = "House Value")
35
  ##title Putting it all together:
36
 
37
  gr.Interface(fn=predictPrice, inputs=[input1, input2, input3, input4, input5, input6, input7, input8],
38
- outputs=output1).launch(show_error=True)
 
7
  scaler = load('scaler_lab4.joblib')
8
  KNN_Regressor = load('knn_lab4.joblib')
9
 
10
+
11
  ## Building a Fubction for prediction:
12
 
13
  def predictPrice(input1, input2, input3, input4, input5, input6, input7, input8):
14
  features = np.array([[input1, input2, input3, input4, input5, input6, input7, input8]])
15
  features_scaled = scaler.transform(features)
16
  prediction = KNN_Regressor.predict(features_scaled)
17
+ return prediction.item()
 
 
 
18
 
19
+
20
  ## Buidling inputs and outputs:
21
 
22
  input1 = gr.Slider(-124.35, -114.31, step=5, label = "Longitude")
 
34
  ##title Putting it all together:
35
 
36
  gr.Interface(fn=predictPrice, inputs=[input1, input2, input3, input4, input5, input6, input7, input8],
37
+ outputs=output1).launch(show_error=True, share=True)