jiehou commited on
Commit
a140c46
·
1 Parent(s): c3fc713

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -2,6 +2,11 @@ import gradio as gr
2
  import pandas as pd
3
  import numpy as np
4
 
 
 
 
 
 
5
  # define the input module
6
  inputs = [
7
  gr.inputs.Number(label="Longitude"),
@@ -37,11 +42,8 @@ def predict_price(longitude, latitude, housing_median_age, total_rooms, total_be
37
 
38
  features=scaler.transform(features)
39
  linear_regression_prediction = lin_reg.predict(features)[0]
40
- decision_tree_prediction = tree_reg.predict(features)[0]
41
 
42
- return {
43
- 'Linear Regression Prediction': linear_regression_prediction,
44
- 'Decision Tree Prediction': decision_tree_prediction
45
- }
46
 
47
  interface = gr.Interface(fn=predict_price, inputs=inputs, outputs=outputs).launch()
 
2
  import pandas as pd
3
  import numpy as np
4
 
5
+
6
+ import pickle
7
+ with open("linear_regression_model.pkl", "rb") as file:
8
+ lin_reg = pickle.load(file)
9
+
10
  # define the input module
11
  inputs = [
12
  gr.inputs.Number(label="Longitude"),
 
42
 
43
  features=scaler.transform(features)
44
  linear_regression_prediction = lin_reg.predict(features)[0]
45
+ #decision_tree_prediction = tree_reg.predict(features)[0]
46
 
47
+ return linear_regression_prediction
 
 
 
48
 
49
  interface = gr.Interface(fn=predict_price, inputs=inputs, outputs=outputs).launch()