MightyOctopus commited on
Commit
66ef536
·
verified ·
1 Parent(s): 846f2fe

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +43 -0
Dockerfile ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ===============================
2
+ # Base image: includes Python 3.9, PyTorch (CPU), and Transformers
3
+ # ===============================
4
+ FROM huggingface/transformers-pytorch-cpu:latest
5
+
6
+ # Set working directory
7
+ WORKDIR /app
8
+
9
+ # ===============================
10
+ # Pre-download and cache model weights
11
+ # ===============================
12
+ RUN python -c "from transformers import AutoTokenizer, AutoModelForSequenceClassification; \
13
+ model='fakespot-ai/roberta-base-ai-text-detection-v1'; \
14
+ AutoTokenizer.from_pretrained(model, cache_dir='/app/model'); \
15
+ AutoModelForSequenceClassification.from_pretrained(model, cache_dir='/app/model')"
16
+
17
+ # ===============================
18
+ # Copy dependency list and install packages
19
+ # ===============================
20
+ COPY requirements.txt .
21
+ RUN pip install --no-cache-dir -r requirements.txt
22
+
23
+ # ===============================
24
+ # Copy application files
25
+ # ===============================
26
+ COPY . .
27
+
28
+ # ===============================
29
+ # Environment configuration
30
+ # ===============================
31
+ ENV TRANSFORMERS_CACHE=/app/model \
32
+ HF_HOME=/app/model \
33
+ PYTHONUNBUFFERED=1
34
+
35
+ # ===============================
36
+ # Expose Gradio default port
37
+ # ===============================
38
+ EXPOSE 7860
39
+
40
+ # ===============================
41
+ # Start the Gradio app
42
+ # ===============================
43
+ CMD ["python", "app.py"]