sga123 commited on
Commit
3fa9533
·
verified ·
1 Parent(s): a34c96d

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. Dockerfile +18 -0
  2. app.py +14 -0
  3. requirements.txt +10 -0
Dockerfile ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ FROM python:3.9-slim
3
+
4
+ # Set the working directory inside the container
5
+ WORKDIR /app
6
+
7
+ # Copy all files from the current directory to the container's working directory
8
+ COPY . .
9
+
10
+ # Install dependencies from the requirements file without using cache to reduce image size
11
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
12
+
13
+ # Define the command to start the application using Gunicorn with 4 worker processes
14
+ # - `-w 4`: Uses 4 worker processes for handling requests
15
+ # - `-b 0.0.0.0:7860`: Binds the server to port 7860 on all network interfaces
16
+ # - `app:app`: Runs the Flask app (assuming `app.py` contains the Flask instance named `app`)
17
+ CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "app:supermarket_product_price_api"]
18
+
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import joblib
2
+ import pandas as pd
3
+ from flask import Flask, request, jsonify
4
+
5
+ # Initialize Flask app
6
+ house_price_api = Flask("Supermarket Product Price Predictor")
7
+
8
+ # Load the trained Boston housing model
9
+ model = joblib.load(saved_model_path)
10
+
11
+ # Define a route for the home page
12
+ @house_price_api.get('/')
13
+ def home():
14
+ return "Welcome to the Supermarket Product Price Predictor!"
requirements.txt ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
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
+ Werkzeug==2.2.2
7
+ flask==2.2.2
8
+ gunicorn==20.1.0
9
+ requests==2.28.1
10
+ uvicorn[standard]