Leanne Tan commited on
Commit
4233cd8
·
unverified ·
1 Parent(s): b65dbdc

Add Dockerfile and switch to docker SDK

Browse files
Files changed (3) hide show
  1. Dockerfile +31 -0
  2. README.md +1 -3
  3. requirements.txt +1 -1
Dockerfile ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.13-slim
2
+
3
+ # Install build dependencies
4
+ RUN apt-get update && \
5
+ apt-get install -y --no-install-recommends build-essential git && \
6
+ rm -rf /var/lib/apt/lists/*
7
+
8
+ # Create the non-root user expected by Hugging Face Spaces
9
+ RUN useradd -m -u 1000 user
10
+
11
+ USER user
12
+
13
+ ENV HOME=/home/user \
14
+ PATH=/home/user/.local/bin:$PATH \
15
+ PYTHONDONTWRITEBYTECODE=1 \
16
+ PYTHONUNBUFFERED=1 \
17
+ PORT=7860
18
+
19
+ WORKDIR $HOME/app
20
+
21
+ # Install Python dependencies first to leverage Docker layer caching
22
+ COPY --chown=user requirements.txt .
23
+ RUN pip install --no-cache-dir --upgrade pip && \
24
+ pip install --no-cache-dir -r requirements.txt
25
+
26
+ # Copy the rest of the application code
27
+ COPY --chown=user . .
28
+
29
+ EXPOSE 7860
30
+
31
+ CMD ["python", "app.py"]
README.md CHANGED
@@ -3,9 +3,7 @@ title: Off Topic Guardrail Demo
3
  emoji: 🙅
4
  colorFrom: red
5
  colorTo: blue
6
- sdk: gradio
7
- sdk_version: 5.6.0
8
- app_file: app.py
9
  pinned: false
10
  ---
11
 
 
3
  emoji: 🙅
4
  colorFrom: red
5
  colorTo: blue
6
+ sdk: docker
 
 
7
  pinned: false
8
  ---
9
 
requirements.txt CHANGED
@@ -1,5 +1,5 @@
1
  gradio
2
- huggingface-hub==0.25.1
3
  safetensors
4
  torch
5
  transformers
 
1
  gradio
2
+ huggingface-hub
3
  safetensors
4
  torch
5
  transformers