sarch7040 commited on
Commit
990805c
·
1 Parent(s): ef80e53

Fixed cache write permissions

Browse files
Dockerfile CHANGED
@@ -1,25 +1,21 @@
1
- FROM python:3.10-slim-bullseye
 
2
 
 
3
  WORKDIR /app
4
 
5
- COPY . /app/
 
6
 
7
- # Upgrade pip
8
- RUN pip install --upgrade pip
 
9
 
10
- # Install system dependencies for scientific libraries
11
- RUN apt-get update && apt-get install -y \
12
- build-essential \
13
- cmake \
14
- libopenblas-dev \
15
- liblapack-dev \
16
- libjpeg-dev \
17
- zlib1g-dev \
18
- && rm -rf /var/lib/apt/lists/*
19
 
20
- # Install Python dependencies
21
- RUN pip install torch torchvision numpy scipy pandas matplotlib scikit-learn flask transformers
22
 
23
- EXPOSE 3000
24
-
25
- CMD ["python", "./app.py"]
 
1
+ # Use an official lightweight Python image
2
+ FROM python:3.9-slim
3
 
4
+ # Set a working directory
5
  WORKDIR /app
6
 
7
+ # Define a writable cache directory
8
+ ENV TRANSFORMERS_CACHE=/tmp/.cache
9
 
10
+ # Copy requirements.txt and install dependencies
11
+ COPY requirements.txt .
12
+ RUN pip install --no-cache-dir -r requirements.txt
13
 
14
+ # Copy the rest of the application files
15
+ COPY . .
 
 
 
 
 
 
 
16
 
17
+ # Expose the port Flask will run on
18
+ EXPOSE 7860
19
 
20
+ # Run Flask on the correct host and port
21
+ CMD ["flask", "run", "--host", "0.0.0.0", "--port", "7860"]
 
__pycache__/translation_model.cpython-312.pyc DELETED
Binary file (942 Bytes)
 
app.py CHANGED
@@ -17,4 +17,5 @@ def translate_text():
17
  return render_template('index.html', original_text=input_text, translated_text=translated_text, time_taken=translation_time)
18
 
19
  if __name__ == '__main__':
20
- app.run(debug=True)
 
 
17
  return render_template('index.html', original_text=input_text, translated_text=translated_text, time_taken=translation_time)
18
 
19
  if __name__ == '__main__':
20
+ app.run(host='0.0.0.0', port=7860)
21
+
requirements.txt CHANGED
@@ -1,5 +1,6 @@
1
  torch
2
  tranformers
3
  flask
 
4
 
5
 
 
1
  torch
2
  tranformers
3
  flask
4
+ sentencepiece
5
 
6