tyriop commited on
Commit
3a828c3
·
verified ·
1 Parent(s): 49e286b

Upload 6 files

Browse files
Files changed (6) hide show
  1. Dockerfile +8 -13
  2. README.md +1 -1
  3. app.py +42 -0
  4. finalModel.joblib +3 -0
  5. gitattributes +35 -0
  6. requirements.txt +2 -3
Dockerfile CHANGED
@@ -1,21 +1,16 @@
 
1
  FROM python:3.9-slim
2
 
 
3
  WORKDIR /app
4
 
5
- RUN apt-get update && apt-get install -y \
6
- build-essential \
7
- curl \
8
- software-properties-common \
9
- git \
10
- && rm -rf /var/lib/apt/lists/*
11
-
12
- COPY requirements.txt ./
13
- COPY src/ ./src/
14
 
 
15
  RUN pip3 install -r requirements.txt
16
 
17
- EXPOSE 8501
18
-
19
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
20
 
21
- ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
1
+ # Use a minimal base image with Python 3.9 installed
2
  FROM python:3.9-slim
3
 
4
+ # Set the working directory inside the container to /app
5
  WORKDIR /app
6
 
7
+ # Copy all files from the current directory on the host to the container's /app directory
8
+ COPY . .
 
 
 
 
 
 
 
9
 
10
+ # Install Python dependencies listed in requirements.txt
11
  RUN pip3 install -r requirements.txt
12
 
13
+ # Define the command to run the Streamlit app on port 8501 and make it accessible externally
14
+ CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]
 
15
 
16
+ # NOTE: Disable XSRF protection for easier external access in order to make batch predictions
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: SuperKartTest
3
  emoji: 🚀
4
  colorFrom: red
5
  colorTo: red
 
1
  ---
2
+ title: Superkart12
3
  emoji: 🚀
4
  colorFrom: red
5
  colorTo: red
app.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ import streamlit as st
4
+ import requests
5
+
6
+ st.title("Welcome to SuperKart Revenue Forecast") #Complete the code to define the title of the app.
7
+
8
+ # Input fields for product and store data
9
+ Product_Weight = st.number_input("Product Weight", min_value=0.0, value=12.66)
10
+ Product_Sugar_Content = st.selectbox("Product Sugar Content", ["Low Sugar", "Regular", "No Sugar"])
11
+ Product_Allocated_Area = st.number_input("Product Allocated Area", min_value=0.004, max_value = 0.298, value=0.1) #Complete the code to define the UI element for Product_Allocated_Area
12
+ Product_MRP = st.number_input("Product MRP", min_value=31, max_value = 266, value=160) #Complete the code to define the UI element for Product_MRP
13
+ Store_Size = st.selectbox("Store Size", ["High", "Medium", "Small"]) #Complete the code to define the UI element for Store_Size
14
+ Store_Location_City_Type = st.selectbox("Store Location Type", ["Tier 1", "Tier 2", "Tier 3"]) #Complete the code to define the UI element for Store_Location_City_Type
15
+ Store_Type = st.selectbox("Store Type", ["Departmental Store", "Food Mart", "Supermarket Type1", "Supermarket Type2"]) #Complete the code to define the UI element for Store_Type
16
+ Product_Id_char = st.selectbox("DR", ["FD", "NC"]) #Complete the code to define the UI element for Product_Id_char
17
+ Store_Age_Years = st.number_input("Store_Age_Years", min_value=16, max_value = 38, value=20) #Complete the code to define the UI element for Store_Age_Years
18
+ Product_Type_Category = st.selectbox("Product Type/Category", ["Baking Goods", "Breads", "Breakfast", "Canned", "Dairy", "Frozen Foods", "Fruits & Vegetables", "Hard Drinks",
19
+ "Health & Hygiene", "Household", "Meat", "Others", "Seafood", "Snack Foods", "Soft Drinks",
20
+ "Starchy Foods"]) #Complete the code to define the UI element for Product_Type_Category
21
+
22
+ product_data = {
23
+ "Product_Weight": Product_Weight,
24
+ "Product_Sugar_Content": Product_Sugar_Content,
25
+ "Product_Allocated_Area": Product_Allocated_Area,
26
+ "Product_MRP": Product_MRP,
27
+ "Store_Size": Store_Size,
28
+ "Store_Location_City_Type": Store_Location_City_Type,
29
+ "Store_Type": Store_Type,
30
+ "Product_Id_char": Product_Id_char,
31
+ "Store_Age_Years": Store_Age_Years,
32
+ "Product_Type_Category": Product_Type_Category
33
+ }
34
+
35
+ if st.button("Predict", type='primary'):
36
+ response = requests.post("https://nu99-SuperKartRevenueForecastingNU.hf.space/v1/predict", json=product_data) # Complete the code to enter user name and space name to correctly define the endpoint
37
+ if response.status_code == 200:
38
+ result = response.json()
39
+ predicted_sales = result["Sales"]
40
+ st.write(f"Predicted Product Store Sales Total: ${predicted_sales:.2f}")
41
+ else:
42
+ st.error("Error in API request")
finalModel.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5c306fbbd23bba8ff7044b9734321b8ef4d0c3d0555db49eaa5ec592cca7c6f1
3
+ size 184964
gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
requirements.txt CHANGED
@@ -1,3 +1,2 @@
1
- altair
2
- pandas
3
- streamlit
 
1
+ requests==2.32.3
2
+ streamlit==1.45.0