vihu21 commited on
Commit
ddbd3c8
·
verified ·
1 Parent(s): 82ae1aa

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. Dockerfile +10 -20
  2. app.py +2 -2
Dockerfile CHANGED
@@ -1,34 +1,24 @@
1
- # Base image
2
  FROM python:3.9-slim
3
 
4
- # Environment settings
5
  ENV PYTHONDONTWRITEBYTECODE=1
6
  ENV PYTHONUNBUFFERED=1
7
 
8
- # Create non-root user
9
- RUN useradd -m -u 1000 user
 
10
 
11
- # Set working directory
12
  WORKDIR /app
13
 
14
- # Copy dependency file first (better caching)
15
  COPY requirements.txt .
16
 
17
- # Install dependencies
18
  RUN pip install --no-cache-dir -r requirements.txt
19
 
20
- # Copy application code
21
- COPY --chown=user . /app
22
-
23
- # Switch to non-root user
24
- USER user
25
 
26
- # Expose Streamlit port
27
- EXPOSE 8501
28
-
29
- # Streamlit configuration
30
- ENV STREAMLIT_SERVER_PORT=8501
31
- ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
32
 
33
- # Run Streamlit app
34
- CMD ["streamlit", "run", "engine_predict/deployment/app.py"]
 
 
1
  FROM python:3.9-slim
2
 
 
3
  ENV PYTHONDONTWRITEBYTECODE=1
4
  ENV PYTHONUNBUFFERED=1
5
 
6
+ # HF requires port 7860
7
+ ENV STREAMLIT_SERVER_PORT=7860
8
+ ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
9
 
 
10
  WORKDIR /app
11
 
12
+ # Copy dependencies first
13
  COPY requirements.txt .
14
 
 
15
  RUN pip install --no-cache-dir -r requirements.txt
16
 
17
+ # Copy app code
18
+ COPY . .
 
 
 
19
 
20
+ # Expose HF-required port
21
+ EXPOSE 7860
 
 
 
 
22
 
23
+ # Start Streamlit
24
+ CMD ["streamlit", "run", "app.py"]
app.py CHANGED
@@ -10,8 +10,8 @@ HF_MODEL_REPO = "vihu21/adaboost-predictive-maintenance"
10
  MODEL_FILE = "adaboost_pm.joblib"
11
 
12
  model_path = hf_hub_download(
13
- repo_id=HF_MODEL_REPO,
14
- filename=MODEL_FILE,
15
  repo_type="model"
16
  )
17
 
 
10
  MODEL_FILE = "adaboost_pm.joblib"
11
 
12
  model_path = hf_hub_download(
13
+ repo_id="vihu21/adaboost-predictive-maintenance",
14
+ filename="adaboost_pm.joblib",
15
  repo_type="model"
16
  )
17