Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pickle
|
2 |
+
import numpy as np
|
3 |
+
|
4 |
+
def predict_single(customer, dv, model):
|
5 |
+
X = dv.transform([customer])
|
6 |
+
y_pred = model.predict(X)
|
7 |
+
return y_pred[0]
|
8 |
+
|
9 |
+
with open('price-prediction-model.bin', 'rb') as f_in:
|
10 |
+
dv, model = pickle.load(f_in)
|
11 |
+
|
12 |
+
|
13 |
+
used_phone_sample = {
|
14 |
+
|
15 |
+
}
|
16 |
+
|
17 |
+
prediction = predict_single(used_phone_sample, dv, model)
|
18 |
+
|
19 |
+
print(f'prediction: {round(prediction,2)}')
|