pepperjirakit commited on
Commit
eb7317a
1 Parent(s): 6db5561

Update app.py

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