DeepthiJ28 commited on
Commit
5b95c6f
·
verified ·
1 Parent(s): e065ce5

Upload folder using huggingface_hub

Browse files
Dockerfile CHANGED
@@ -1,20 +1,16 @@
1
- FROM python:3.13.5-slim
2
 
 
3
  WORKDIR /app
4
 
5
- RUN apt-get update && apt-get install -y \
6
- build-essential \
7
- curl \
8
- git \
9
- && rm -rf /var/lib/apt/lists/*
10
 
11
- COPY requirements.txt ./
12
- COPY src/ ./src/
13
 
14
- RUN pip3 install -r requirements.txt
15
-
16
- EXPOSE 8501
17
-
18
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
19
-
20
- ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
1
+ FROM python:3.9-slim
2
 
3
+ # Set the working directory inside the container
4
  WORKDIR /app
5
 
6
+ # Copy all files from the current directory to the container's working directory
7
+ COPY . .
 
 
 
8
 
9
+ # Install dependencies from the requirements file without using cache to reduce image size
10
+ RUN pip install --upgrade -r requirements.txt
11
 
12
+ # Define the command to start the application using Gunicorn with 4 worker processes
13
+ # - `-w 4`: Uses 4 worker processes for handling requests
14
+ # - `-b 0.0.0.0:7860`: Binds the server to port 7860 on all network interfaces
15
+ # - `app:app`: Runs the Flask app (assuming `app.py` contains the Flask instance named `app`)
16
+ CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:8080", "app:app"]
 
 
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import joblib
2
+ import pandas as pd
3
+ from flask import Flask, request, jsonify
4
+
5
+ import time
6
+ start = time.time()
7
+
8
+ # Initialize Flask app with a name
9
+ app = Flask("Superkart Sales Predictor")
10
+
11
+ # Load the trained churn prediction model
12
+ #model = joblib.load("superkart_sales_prediction_model_v1_0.joblib")
13
+
14
+ print(f"Model loaded in {time.time() - start:.2f} seconds")
15
+
16
+ # Define a route for the home page
17
+ @app.get('/')
18
+ def home():
19
+ return "Welcome to the Superkart Sales Prediction API"
20
+
21
+ # Run the Flask app in debug mode
22
+ if __name__ == '__main__':
23
+ app.run(debug=True)
requirements.txt CHANGED
@@ -1,3 +1,10 @@
1
- altair
2
- pandas
3
- streamlit
 
 
 
 
 
 
 
 
1
+ pandas==2.2.2
2
+ numpy==2.0.2
3
+ scikit-learn==1.6.1
4
+ joblib==1.4.2
5
+ Werkzeug==2.2.2
6
+ flask==2.2.2
7
+ gunicorn==20.1.0
8
+ requests==2.28.1
9
+ uvicorn[standard]
10
+ streamlit==1.43.2
superkart_sales_prediction_model_v1_0.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:724ef8d892ab1475996176a84c27e4592751d547524d66212d6de005c89f889b
3
+ size 53187