custumer_risk_credit / requirements.txt
pepperjirakit's picture
Update requirements.txt
973d0c7
raw
history blame
1.71 kB
import joblib import pandas as pd import streamlit as st
model = joblib.load("daimond.joblib") unique_values = joblib.load("unique_values.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==True only when the button is clicked
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]}))
# Show prediction
st.success("Your predicted income is"+result)
if name == "main": main()