File size: 1,858 Bytes
4646333 aafa04e eebe194 aafa04e e9b00aa 1f45ddb e9b00aa aafa04e f1cc3ac 6bb9bbb c5b9af9 aafa04e 7752d4f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
import pickle
import gradio as gr
# Load the pickled model
with open('./Automatidata_gui.pickle', 'rb') as file:
model = pickle.load(file)
# Define the function for making predictions
def automatidata(VendorID, passenger_count, Distance, Duration, rush_hour):
inputs = [[VendorID, passenger_count, Distance, Duration, rush_hour]]
prediction = model.predict(inputs)
prediction_value = prediction[0][0]
return f"Fare amount(approx.) = {round(prediction_value, 2)} $"
# Create the Gradio interface
automatidata_ga = gr.Interface(fn=automatidata,
inputs=[
gr.Number(1, 2, label="VendorID - [1 or 2]"),
gr.Number(0, 6, label="Passenger Count - [1 to 6]"),
gr.Number(label="Distance in miles"),
gr.Number(label="Duration in mins"),
gr.Number(0, 1, label="Rush Hour - [0 or 1]")
],
outputs="text", title="New York City Taxi and Limousine Commission (TLC) - Taxi Fares Estimator",
examples = [
[2,1,2.33,15.09,0],
[1,2,4.22,24.29,0],
[1,1,0.71,6.66,0],
[2,1,0.97,8.37,0],
[2,3,1.48,8.92,0],
],
description="Predicting Taxi Fare Amount Using Machine Learning.",
theme='dark'
)
automatidata_ga.launch(share=True)
|