Pushpak21 commited on
Commit
647f264
·
verified ·
1 Parent(s): 946135d

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. Dockerfile +12 -20
  2. app.py +2 -1
Dockerfile CHANGED
@@ -1,32 +1,24 @@
1
- # Use a minimal Python base image
2
- FROM python:3.9-slim
3
 
4
- # Set the working directory
5
  WORKDIR /app
6
 
7
- # Install system dependencies and create a user first
8
- RUN apt-get update && apt-get install -y --no-install-recommends \
9
- build-essential \
10
- && useradd -m -u 1000 user \
11
- && rm -rf /var/lib/apt/lists/*
12
 
13
- # Copy all files into /app
14
- COPY . /app
15
-
16
- # Install Python dependencies
17
- RUN pip install --no-cache-dir --upgrade pip setuptools wheel \
18
- && pip install --no-cache-dir -r requirements.txt
19
-
20
- # Switch to non-root user
21
  USER user
22
  ENV HOME=/home/user \
23
- PATH=/home/user/.local/bin:$PATH
 
 
 
 
 
24
 
25
- # Set working dir for the app
26
  WORKDIR $HOME/app
27
 
28
- # Copy source code again as user (if needed for ownership)
29
  COPY --chown=user . $HOME/app
30
 
31
- # Default command to launch Streamlit
32
  CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]
 
1
+ # Use a minimal base image with Python 3.9 installed
2
+ FROM python:3.9
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
  USER user
11
  ENV HOME=/home/user \
12
+ PATH=/home/user/.local/bin:$PATH
13
+
14
+ # Install Python dependencies listed in requirements.txt
15
+ RUN pip3 install -r requirements.txt
16
+
17
+ RUN useradd -m -u 1000 user
18
 
 
19
  WORKDIR $HOME/app
20
 
 
21
  COPY --chown=user . $HOME/app
22
 
23
+ # Define the command to run the Streamlit app on port "8501" and make it accessible externally
24
  CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]
app.py CHANGED
@@ -2,12 +2,13 @@
2
  import streamlit as st
3
  import pandas as pd
4
  import joblib
5
- from huggingface_hub import hf_hub_download
6
 
7
  # Download and load the model
8
  model_path = hf_hub_download(repo_id="Pushpak21/tourism-package-model", filename="best_tourism_package_model.joblib")
9
  model = joblib.load(model_path)
10
 
 
11
  # Feature descriptions
12
  feature_info = {
13
  "Age": "Age of the customer (years).",
 
2
  import streamlit as st
3
  import pandas as pd
4
  import joblib
5
+
6
 
7
  # Download and load the model
8
  model_path = hf_hub_download(repo_id="Pushpak21/tourism-package-model", filename="best_tourism_package_model.joblib")
9
  model = joblib.load(model_path)
10
 
11
+
12
  # Feature descriptions
13
  feature_info = {
14
  "Age": "Age of the customer (years).",