Parthebhan commited on
Commit
8537724
·
verified ·
1 Parent(s): 0651fe5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -1
app.py CHANGED
@@ -1 +1,31 @@
1
- pip install pickle torch numpy
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pickle
3
+
4
+ def read_pickle(path, saved_model_name:str):
5
+ with open(path + saved_model_name + '.pickle', 'rb') as to_read:
6
+ model = pickle.load(to_read)
7
+ return model
8
+
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
+ path = 'F:/Case study/Interview preparation/01.Project/1. Automatidata/Final/'
16
+ model = read_pickle(path,'Automatidata_gui')
17
+
18
+ automatidata_ga = gr.Interface(fn=automatidata,
19
+ inputs = [
20
+ gr.Number(1,2, label="VendorID - [1, 2]"),
21
+ gr.Number(0,6, label="Passenger Count"),
22
+ gr.Number(label="Distance"),
23
+ gr.Number(label="Duration"),
24
+ gr.Number(0,1, label="Rush Hour")
25
+ ],
26
+ outputs = "text",title="Taxi Fares Estimater",
27
+ description="Predicting Taxi Fare Amount Using Machine Learning.",
28
+ )
29
+
30
+ if __name__ == "__main__":
31
+ automatidata_ga.launch(share=True)