Parthebhan's picture
Update app.py
eebe194 verified
raw
history blame
1.33 kB
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"),
gr.Number(label="Duration"),
gr.Number(0, 1, label="Rush Hour - [0 or 1]")
],
outputs="text", title="Taxi Fares Estimator",
description="Predicting Taxi Fare Amount Using Machine Learning.",
theme='dark'
)
automatidata_ga.launch(auth = ('user','auto'),share=True)