| 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}") |