Mahmoud7 commited on
Commit
783813a
·
1 Parent(s): ff5c136

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +2 -2
  2. app.py +28 -0
  3. requirements.txt +3 -5
Dockerfile CHANGED
@@ -8,6 +8,6 @@ RUN pip install -r requirements.txt
8
 
9
  COPY . /app
10
 
11
- EXPOSE 8008
12
 
13
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8008"]
 
8
 
9
  COPY . /app
10
 
11
+ EXPOSE 8511
12
 
13
+ ENTRYPOINT ["streamlit","run","app.py"]
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 CHANGED
@@ -1,6 +1,4 @@
1
  pandas==1.4.2
2
- uvicorn==0.18.3
3
- pydantic==1.10.2
4
- pickle-mixin==1.0.2
5
- fastapi==0.85.1
6
- scikit-learn==1.1.2
 
1
  pandas==1.4.2
2
+ scikit-learn==1.1.2
3
+ streamlit==1.14.0
4
+ requests==2.27.1