Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pickle
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
# Load the pickled model
|
5 |
+
with open('./Automatidata_gui.pickle', 'rb') as file:
|
6 |
+
model = pickle.load(file)
|
7 |
+
|
8 |
+
# Define the function for making predictions
|
9 |
+
def automatidata(VendorID, passenger_count, Distance, Duration, rush_hour):
|
10 |
+
inputs = [[VendorID, passenger_count, Distance, Duration, rush_hour]]
|
11 |
+
prediction = model.predict(inputs)
|
12 |
+
prediction_value = prediction[0][0]
|
13 |
+
return f"Fare amount(approx.) = {round(prediction_value, 2)} $"
|
14 |
+
|
15 |
+
# Create the Gradio interface
|
16 |
+
automatidata_ga = gr.Interface(fn=automatidata,
|
17 |
+
inputs=[
|
18 |
+
gr.Number(1, 2, label="VendorID - [1 or 2]"),
|
19 |
+
gr.Number(0, 6, label="Passenger Count - [1 to 6]"),
|
20 |
+
gr.Number(label="Distance in miles"),
|
21 |
+
gr.Number(label="Duration in mins"),
|
22 |
+
gr.Number(0, 1, label="Rush Hour - [0 or 1]")
|
23 |
+
],
|
24 |
+
outputs="text", title="New York City Taxi and Limousine Commission (TLC) - Taxi Fares Estimator",
|
25 |
+
description="Predicting Taxi Fare Amount Using Machine Learning.",
|
26 |
+
theme='dark'
|
27 |
+
)
|
28 |
+
|
29 |
+
automatidata_ga.launch(share=True)
|