MattVarg commited on
Commit
9e0535a
·
verified ·
1 Parent(s): e936651

Upload folder using huggingface_hub

Browse files
Dockerfile ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
app.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import streamlit as st
3
+ import pandas as pd
4
+ import joblib
5
+ import numpy as np
6
+
7
+ # Load the trained model
8
+ @st.cache_resource
9
+ def load_model():
10
+ return joblib.load("deployment_files/super_kart_prediction_model_v1_0.joblib")
11
+
12
+ model = load_model()
13
+
14
+ # Streamlit UI for Price Prediction
15
+ st.title("Super Kart Forecasting App")
16
+ st.write("This tool predicts the Sales Strategies")
17
+
18
+ st.subheader("Enter the listing details:")
19
+
20
+ # Collect user input
21
+ product_weight = st.number_input("Weight", min_value=1, step=1, value=2)
22
+ Product_Sugar_Content = st.selectbox("Sugar", ["Low", "Regular", "No"])
23
+ Product_Allocated_Area = st.number_input("Area", min_value=1, step=1, value=2)
24
+ Product_Type = st.selectbox("Product type", ["meat", "snack foods", "hard drinks", "dairy", "canned", "soft drinks", "health","hygiene", "baking goods", "bread", "breakfast", "frozen foods", "fruits","vegetables", "household", "seafood", "starchy foods", "others"])
25
+ Product_MRP = st.number_input("MRP", min_value=1, step=1, value=2)
26
+ Store_Establishment_Year = st.number_input("year", min_value=1950, step=1, value=2)
27
+ Store_Size = st.selectbox("Store Size", ["High", "Medium", "Low"])
28
+ Store_Location_City_Type = st.selectbox("Store City Type", ["Tier 1", "Tier 2", "Tier 3"])
29
+ Store_Type = st.selectbox("Store Type", ["Departmental Store", "Supermarket Type 1", "Supermarket Type 2","Food Mart"])
30
+
31
+ # Convert user input into a DataFrame
32
+ input_data = pd.DataFrame([{
33
+ 'product_weight': product_weight,
34
+ 'Product_Sugar_Content': Product_Sugar_Content,
35
+ 'Product_Allocated_Area': Product_Allocated_Area,
36
+ 'Product_Type': Product_Type,
37
+ 'Product_MRP': Product_MRP,
38
+ 'Store_Establishment_Year': Store_Establishment_Year,
39
+ 'Store_Size': Store_Size,
40
+ 'Store_Location_City_Type': Store_Location_City_Type,
41
+ 'Store_Type': Store_Type
42
+ }])
43
+
44
+ # Predict button
45
+ if st.button("Predict"):
46
+ prediction = model.predict(input_data)
47
+ st.write(f"The predicted value ${np.exp(prediction)[0]:.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
super_kart_prediction_model_v1_0.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e8bb5aa05c3370560197c9b842bd5a3d938f3abc0f5f5b122a18ec355d555fee
3
+ size 207896