martinnnuez
commited on
Commit
•
54ae934
1
Parent(s):
0cabfb3
Update app.py
Browse files
app.py
CHANGED
@@ -20,10 +20,11 @@ def predict(features):
|
|
20 |
preds = model.predict(X)
|
21 |
return float(preds[0])
|
22 |
|
23 |
-
def main(
|
24 |
"""request input, preprocess it and make prediction"""
|
25 |
input_data = {
|
26 |
-
"
|
|
|
27 |
"trip_distance": trip_distance
|
28 |
}
|
29 |
features = prepare_features(input_data)
|
@@ -39,6 +40,7 @@ def main(PU_DO,trip_distance):
|
|
39 |
#input
|
40 |
input1 = gr.inputs.Number()
|
41 |
input2 = gr.inputs.Number()
|
|
|
42 |
|
43 |
#output object
|
44 |
output = gr.outputs.Textbox()
|
@@ -46,7 +48,7 @@ output = gr.outputs.Textbox()
|
|
46 |
intf = gr.Interface(title = "New York taxi duration prediction",
|
47 |
description = "The objective of this project is to predict the duration of a taxi trip in the city of New York.",
|
48 |
fn=main,
|
49 |
-
inputs=[input1,input2],
|
50 |
outputs=[output],
|
51 |
live=True,
|
52 |
enable_queue=True
|
|
|
20 |
preds = model.predict(X)
|
21 |
return float(preds[0])
|
22 |
|
23 |
+
def main(PULocationID,DOLocationID,trip_distance):
|
24 |
"""request input, preprocess it and make prediction"""
|
25 |
input_data = {
|
26 |
+
"PULocationID": PULocationID,
|
27 |
+
"DOLocationID": DOLocationID,
|
28 |
"trip_distance": trip_distance
|
29 |
}
|
30 |
features = prepare_features(input_data)
|
|
|
40 |
#input
|
41 |
input1 = gr.inputs.Number()
|
42 |
input2 = gr.inputs.Number()
|
43 |
+
input3 = gr.inputs.Number()
|
44 |
|
45 |
#output object
|
46 |
output = gr.outputs.Textbox()
|
|
|
48 |
intf = gr.Interface(title = "New York taxi duration prediction",
|
49 |
description = "The objective of this project is to predict the duration of a taxi trip in the city of New York.",
|
50 |
fn=main,
|
51 |
+
inputs=[input1,input2,input3],
|
52 |
outputs=[output],
|
53 |
live=True,
|
54 |
enable_queue=True
|