Skip to content

Commit

Permalink
Merge pull request #264 from COS301-SE-2024/feature/backend/Model_Dep…
Browse files Browse the repository at this point in the history
…loyment

Feature/backend/model deployment
  • Loading branch information
Rethakgetse-Manaka authored Aug 4, 2024
2 parents 9967eb6 + 61cc1d8 commit ebec8a7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
20 changes: 20 additions & 0 deletions python-code/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use the official Python image from the Docker Hub
FROM python:3.9-slim

# Set the working directory in the container
WORKDIR /app

# Copy the requirements file into the container
COPY requirements.txt requirements.txt

# Install the dependencies
RUN pip install -r requirements.txt

# Copy the rest of the application code into the container
COPY . .

# Expose the port the app runs on
EXPOSE 9000

# Define the command to run the application using Gunicorn
CMD ["gunicorn", "app:app", "-b", "0.0.0.0:9000", "-w", "4"]
4 changes: 2 additions & 2 deletions python-code/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def predict():
# Set factor based on special event
# factor = 1.5 if special_event else 1.0

predicted_class, predicted_attendance_level = get_prediction(day_of_week, month, day_of_month, weekend, special_event, scaler, factor)
predicted_class, predicted_attendance_level = get_prediction(day_of_week, month, day_of_month, weekend, special_event, scaler)

return jsonify({
'Day_of_Week': day_of_week,
Expand Down Expand Up @@ -74,7 +74,7 @@ def predict_week():
# factor = 1.5 if special_event else 1.0

# Get prediction
predicted_class, predicted_attendance_level = get_prediction(day_of_week, month, day_of_month, weekend, special_event, scaler, factor)
predicted_class, predicted_attendance_level = get_prediction(day_of_week, month, day_of_month, weekend, special_event, scaler)

# Append the results
predictions.append({
Expand Down

0 comments on commit ebec8a7

Please sign in to comment.