File size: 862 Bytes
783813a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
import streamlit as st
import pandas as pd
import requests
import json
st.write(""" # Mobile Price-Range Prediction""")
st.sidebar.header("Choose Phone Specs")
def input_features():
battery_power = st.sidebar.slider("battery power",500,2000,1000)
pix_height = st.sidebar.slider("pix height",0,2000,1000)
pix_width = st.sidebar.slider("pix width",0,2000,1000)
ram = st.sidebar.slider("ram",400,4000,2000)
data = {"battery_power":battery_power,
"px_height":pix_height,
"px_width":pix_width,
"ram":ram}
feats = pd.DataFrame(data,index=[0])
return feats, data
feats, data = input_features()
st.subheader("Phone Specs")
st.write(feats)
if st.button("Result"):
res = requests.post(url = "http://0.0.0.0:8008/predict", data=json.dumps(data)).text
st.subheader(f"Predicted Price Range: {res}") |