pepperjirakit commited on
Commit
e055e29
1 Parent(s): 9e2d9d4

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -0
app.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import joblib import pandas as pd import streamlit as st
2
+
3
+ model = joblib.load("daimondxb.joblib") unique_values = joblib.load("unique_values (1).joblib")
4
+
5
+ unique_cut = unique_values["cut"] unique_color = unique_values["color"] unique_clarity = unique_values["clarity"]
6
+
7
+ def main(): st.title("Diamond Prices")
8
+
9
+ with st.form("questionaire"):
10
+ carat = st.slider("Carat",min_value=0.00,max_value=5.00)
11
+ cut = st.selectbox("Cut", options=unique_cut)
12
+ color = st.selectbox("Color", options=unique_color)
13
+ clarity = st.selectbox("Clarity", options=unique_clarity)
14
+ depth = st.slider("Depth",min_value=0.00,max_value=100.00)
15
+ table = st.slider("table",min_value=0.00,max_value=100.00)
16
+ x = st.slider("length(mm)",min_value=0.01,max_value=10.00)
17
+ y = st.slider("width(mm)",min_value=0.01,max_value=10.00)
18
+ z = st.slider("depth(mm)",min_value=0.01,max_value=10.00)
19
+
20
+
21
+ # clicked==True only when the button is clicked
22
+ clicked = st.form_submit_button("Predict Price")
23
+ if clicked:
24
+ result=model.predict(pd.DataFrame({"carat": [carat],
25
+ "cut": [cut],
26
+ "color": [color],
27
+ "clarity": [clarity],
28
+ "depth":[depth],
29
+ "table": [table],
30
+ "size": [size],
31
+ "length(mm)":[x],
32
+ "width(mm)":[y],
33
+ "depth(mm)":[z]}))
34
+ # Show prediction
35
+ st.success("Your predicted income is"+result)
36
+ if name == "main": main()