Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -67,3 +67,36 @@ def predict_product_sales():
|
|
| 67 |
# Run the Flask application in debug mode if this script is executed directly
|
| 68 |
if __name__ == '__main__':
|
| 69 |
store_product_sales_predictor_api.run(debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
# Run the Flask application in debug mode if this script is executed directly
|
| 68 |
if __name__ == '__main__':
|
| 69 |
store_product_sales_predictor_api.run(debug=True)
|
| 70 |
+
Overwriting backend_files/app.py
|
| 71 |
+
Dependencies File
|
| 72 |
+
%%writefile backend_files/requirements.txt
|
| 73 |
+
pandas==2.2.2
|
| 74 |
+
numpy==2.0.2
|
| 75 |
+
scikit-learn==1.6.1
|
| 76 |
+
xgboost==2.1.4
|
| 77 |
+
joblib==1.4.2
|
| 78 |
+
Werkzeug==2.2.2
|
| 79 |
+
flask==2.2.2
|
| 80 |
+
gunicorn==20.1.0
|
| 81 |
+
requests==2.28.1
|
| 82 |
+
uvicorn[standard]
|
| 83 |
+
streamlit==1.43.2
|
| 84 |
+
Writing backend_files/requirements.txt
|
| 85 |
+
Dockerfile
|
| 86 |
+
%%writefile backend_files/Dockerfile
|
| 87 |
+
FROM python:3.9-slim
|
| 88 |
+
|
| 89 |
+
# Set the working directory inside the container
|
| 90 |
+
WORKDIR /app
|
| 91 |
+
|
| 92 |
+
# Copy all files from the current directory to the container's working directory
|
| 93 |
+
COPY . .
|
| 94 |
+
|
| 95 |
+
# Install dependencies from the requirements file without using cache to reduce image size
|
| 96 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 97 |
+
|
| 98 |
+
# Define the command to start the application using Gunicorn with 4 worker processes
|
| 99 |
+
# - `-w 4`: Uses 4 worker processes for handling requests
|
| 100 |
+
# - `-b 0.0.0.0:7860`: Binds the server to port 7860 on all network interfaces
|
| 101 |
+
# - `app:app`: Runs the Flask app (assuming `app.py` contains the Flask instance named `app`)
|
| 102 |
+
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "app:rental_price_predictor_api"]
|