Debashre2824 commited on
Commit
3a84d9a
·
verified ·
1 Parent(s): b858337

Upload Streamlit app and model

Browse files
Files changed (4) hide show
  1. Dockerfile +14 -0
  2. SuperKart_Mode_v1_0.joblib +3 -0
  3. app.py +52 -0
  4. requirements.txt +6 -0
Dockerfile ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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"]
SuperKart_Mode_v1_0.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ff5602dc4d1b205e75d1f0a9fe99155e63c1e1264c99358453d5132066bfb1df
3
+ size 621942
app.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import streamlit as st
3
+ import pandas as pd
4
+ import joblib
5
+
6
+ # Load trained model pipeline
7
+ model = joblib.load('deployment_files/SuperKart_Mode_v1_0.joblib')
8
+
9
+ # Streamlit app title
10
+ st.title("🛒 Product Store Sales Prediction App")
11
+ st.markdown("Enter product and store details below to predict sales.")
12
+
13
+ # Input form
14
+ with st.form("prediction_form"):
15
+ product_weight = st.number_input("Product Weight (in kg)", min_value=1.0, max_value=50.0, value=13.5)
16
+ product_allocated_area = st.number_input("Allocated Area (0 to 1)", min_value=0.001, max_value=1.0, value=0.08)
17
+ product_mrp = st.number_input("Product MRP (₹)", min_value=1.0, max_value=1000.0, value=250.75)
18
+ store_age = st.number_input("Store Age (in years)", min_value=1, max_value=100, value=20)
19
+
20
+ product_sugar_content = st.selectbox("Product Sugar Content", ["Low Sugar", "Regular", "No Sugar", "High Sugar"])
21
+ product_type = st.selectbox("Product Type", [
22
+ "Meat", "Snack Foods", "Hard Drinks", "Dairy", "Canned", "Soft Drinks",
23
+ "Health and Hygiene", "Baking Goods", "Bread", "Breakfast", "Frozen Foods",
24
+ "Fruits and Vegetables", "Household", "Seafood", "Starchy Foods", "Others"
25
+ ])
26
+ store_size = st.selectbox("Store Size", ["Small", "Medium", "High"])
27
+ store_location = st.selectbox("City Tier", ["Tier 1", "Tier 2", "Tier 3"])
28
+ store_type = st.selectbox("Store Type", ["Departmental Store", "Supermarket Type1", "Supermarket Type2", "Food Mart"])
29
+
30
+ submit = st.form_submit_button("Predict Sales")
31
+
32
+ # Prediction logic
33
+ if submit:
34
+ input_dict = {
35
+ "Product_Weight": [product_weight],
36
+ "Product_Allocated_Area": [product_allocated_area],
37
+ "Product_MRP": [product_mrp],
38
+ "Store_Age": [store_age],
39
+ "Product_Sugar_Content": [product_sugar_content],
40
+ "Product_Type": [product_type],
41
+ "Store_Size": [store_size],
42
+ "Store_Location_City_Type": [store_location],
43
+ "Store_Type": [store_type]
44
+ }
45
+
46
+ input_df = pd.DataFrame(input_dict)
47
+
48
+ # Predict using loaded model
49
+ prediction = model.predict(input_df)[0]
50
+
51
+ # Show result
52
+ st.success(f"📈 Predicted Product Store Sales: ₹{prediction:,.2f}")
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ pandas==2.2.2
2
+ numpy==2.0.2
3
+ scikit-learn==1.6.1
4
+ xgboost==2.1.4
5
+ joblib==1.4.2
6
+ streamlit==1.43.2