|
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}") |