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