Update driverpospredictionfinal.py
Browse files- driverpospredictionfinal.py +18 -5
driverpospredictionfinal.py
CHANGED
@@ -7,10 +7,9 @@ Original file is located at
|
|
7 |
https://colab.research.google.com/drive/1DGTfO4HEZDof1phuficJD_J8v38JnF3C
|
8 |
"""
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
|
15 |
|
16 |
from sklearn import tree, linear_model
|
@@ -85,7 +84,21 @@ def hyperamter_tuning_paramter_grid():
|
|
85 |
}#'criterion': ['gini', 'entropy']
|
86 |
return parameter_grid
|
87 |
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
|
90 |
|
91 |
def ask_user(model, X_test=None):
|
|
|
7 |
https://colab.research.google.com/drive/1DGTfO4HEZDof1phuficJD_J8v38JnF3C
|
8 |
"""
|
9 |
|
10 |
+
from flask import Flask,jsonify
|
11 |
+
import json
|
12 |
+
app = Flask(__name__)
|
|
|
13 |
|
14 |
|
15 |
from sklearn import tree, linear_model
|
|
|
84 |
}#'criterion': ['gini', 'entropy']
|
85 |
return parameter_grid
|
86 |
|
87 |
+
@app.route('/predict',methods=['POST']) # api endpoint -any url(requests) with /predict will route to the method
|
88 |
+
def prediction(req):
|
89 |
+
data = json.loads(req)
|
90 |
+
input_data = {}
|
91 |
+
input_data['LapNumber'] = float(data['lapNumber'])
|
92 |
+
input_data['LapTimes'] = float(data['LapTimes'])
|
93 |
+
input_data['PitStopTimes'] = float(data['PitStopTimes'])
|
94 |
+
input_data['PrevLap'] = float(data['PrevLap'])
|
95 |
+
input_data['AvgSpeed'] = float(data['AvgSpeed'])
|
96 |
+
input_data['AirTemp_Cel'] = float(data['AirTemp_Cel'])
|
97 |
+
input_data['TrackTemp_Cel'] = float(data['TrackTemp_Cel'])
|
98 |
+
input_data['Humidity'] = float(data['Humidity'])
|
99 |
+
input_data['WindSpeed_km'] = float(data['WindSpeed_km'])
|
100 |
+
print(input_data)
|
101 |
+
return jsonify({'message':'Hello world'})
|
102 |
|
103 |
|
104 |
def ask_user(model, X_test=None):
|