Spaces:
Runtime error
Runtime error
import streamlit as st | |
import pandas as pd | |
import pickle | |
st.title("predict Phone Proces") | |
#import | |
svr1 = 'svr.pkl' | |
sv = pickle.load(open(svr1, 'rb')) | |
st.write('Insert feature to predict') | |
Ratings = st.slider(label='Ratings', min_value=0, max_value=5, value=4, step=1) | |
Prices = st.slider(label='Prices', min_value=0, max_value=68000, value=11999, step=1) | |
Ram = st.selectbox(label='Ram (GB)', options=['0', '1']) | |
Rom = st.slider(label='Rom(GB)', min_value=0, max_value=200, value=42, step=1) | |
ScreenSize = st.selectbox(label='Screen Size(Inches)', options=['0', '1']) | |
FirstCam = st.slider(label='First Cam (MP)', min_value=100000.0, max_value=999999.0, value=420000.0, step=0.01) | |
SecondCam = st.slider(label='Second Cam (MP)', min_value=0.0, max_value=99.9, value=42.0, step=0.1) | |
ThirdCam = st.slider(label='Third Cam (MP)', min_value=0, max_value=999, value=42, step=1) | |
FourthCam = st.selectbox(label='Fourth Cam (MP)', options=['0', '1']) | |
FrontCam = st.selectbox(label='Front Cam (MP)', options=['0', '1']) | |
Battery= st.slider(label='Batery (mAh)', min_value=0, max_value=999, value=42, step=1) | |
# color = st.number_input(label='Colour', min_value=240, max_value=255, value=245, step=1) | |
# convert into dataframe | |
data = pd.DataFrame({'Ratings': [Ratings], | |
'Prices': [Prices], | |
'Ram ':[Ram], | |
'Rom': [Rom], | |
'ScreenSize': [ScreenSize], | |
'FirstCam ': [FirstCam], | |
'SecondCam': [SecondCam], | |
'ThirdCam': [ThirdCam], | |
'FourthCam': [FourthCam], | |
'FrontCam': [FrontCam], | |
'Battery': [Battery]}) | |
# model predict | |
Phone_price = svr1.predict(data).tolist()[0] | |
# interpretation | |
st.write('Predition Result: ') | |
if Phone_price == 0: | |
st.text('Mahal Jon') | |
else: | |
st.text('Sikat') |