File size: 829 Bytes
587c15e c928341 587c15e 7c2d35d c928341 7c2d35d c928341 587c15e c928341 587c15e c928341 587c15e c928341 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import streamlit as st
import joblib
import numpy as np
with open("src/taxi_linear", "rb") as f:
model = joblib.load(f)
with open("src/X_scaler", "rb") as f:
scaler = joblib.load(f)
st.title(":orange[Taxi] Fare Estimation :taxi:")
passengers = st.number_input("Passengers : ", min_value=1, max_value=6, step=1)
distance = st.number_input("Distance : ", min_value=0.1, max_value=100.0, step=1.0)
tips = st.number_input("Tips : ", min_value=0.1, max_value=50.0, step=1.0)
tolls = st.number_input("Tolls : ", min_value=1, max_value=15, step=1)
if st.button("Estimate"):
model_input = np.array([[passengers, distance, tips, tolls]])
model_input = scaler.transform(model_input)
prediction = model.predict(model_input)
formatted_pred = round(prediction[0], 2)
st.write(f"Your Fare : {formatted_pred}") |