| | import joblib import pandas as pd import streamlit as st |
| |
|
| | model = joblib.load("daimondx.joblib") unique_values = joblib.load("unique_values (1).joblib") |
| |
|
| | unique_cut = unique_values["cut"] unique_color = unique_values["color"] unique_clarity = unique_values["clarity"] |
| |
|
| | def main(): st.title("Diamond Prices") |
| |
|
| | with st.form("questionaire"): |
| | carat = st.slider("Carat",min_value=0.00,max_value=5.00) |
| | cut = st.selectbox("Cut", options=unique_cut) |
| | color = st.selectbox("Color", options=unique_color) |
| | clarity = st.selectbox("Clarity", options=unique_clarity) |
| | depth = st.slider("Depth",min_value=0.00,max_value=100.00) |
| | table = st.slider("table",min_value=0.00,max_value=100.00) |
| | x = st.slider("length(mm)",min_value=0.01,max_value=10.00) |
| | y = st.slider("width(mm)",min_value=0.01,max_value=10.00) |
| | z = st.slider("depth(mm)",min_value=0.01,max_value=10.00) |
| |
|
| |
|
| | |
| | clicked = st.form_submit_button("Predict Price") |
| | if clicked: |
| | result=model.predict(pd.DataFrame({"carat": [carat], |
| | "cut": [cut], |
| | "color": [color], |
| | "clarity": [clarity], |
| | "depth":[depth], |
| | "table": [table], |
| | "size": [size], |
| | "length(mm)":[x], |
| | "width(mm)":[y], |
| | "depth(mm)":[z]})) |
| | |
| | st.success("Your predicted income is"+result) |
| | if name == "main": main() |