Yermek68 commited on
Commit
91daf3d
·
verified ·
1 Parent(s): d19b37d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -8
Dockerfile CHANGED
@@ -1,10 +1,9 @@
1
  # ================================
2
- # ✅ Hugging Face Space DockerfileEroha Summarizer PRO
3
- # Версия: 4.0 (Enterprise Optimized Runtime)
4
  # ================================
5
-
6
  FROM python:3.10-slim
7
 
 
8
  ENV DEBIAN_FRONTEND=noninteractive \
9
  PYTHONUNBUFFERED=1 \
10
  PYTHONIOENCODING=utf8 \
@@ -16,6 +15,7 @@ ENV DEBIAN_FRONTEND=noninteractive \
16
  GRADIO_SERVER_NAME=0.0.0.0 \
17
  PYTHONWARNINGS=ignore
18
 
 
19
  RUN apt-get update && apt-get install -y \
20
  git git-lfs ffmpeg curl wget libgl1 libmagic1 fonts-dejavu-core \
21
  cmake build-essential libprotobuf-dev protobuf-compiler libsentencepiece-dev \
@@ -24,16 +24,22 @@ RUN apt-get update && apt-get install -y \
24
  WORKDIR /app
25
  RUN mkdir -p /home/user/.cache/huggingface && chmod -R 777 /home/user
26
 
 
27
  COPY requirements.txt /app/
28
  RUN pip install --no-cache-dir -U pip setuptools wheel && \
29
  pip install --no-cache-dir -r /app/requirements.txt && \
30
- pip install --no-cache-dir sacremoses protobuf regex tokenizers==0.19.1 && \
31
- pip install --no-cache-dir sentencepiece==0.2.0 && \
32
  pip cache purge
33
 
34
- # --- Патч asyncio ---
 
 
 
 
 
 
35
  RUN echo "\
36
- import warnings, asyncio, selectors\n\
37
  def _patched_close(self):\n\
38
  try:\n\
39
  super(asyncio.SelectorEventLoop, self)._close_self_pipe()\n\
@@ -46,5 +52,6 @@ print('✅ Asyncio patch & warnings muted')\n\
46
 
47
  EXPOSE 7860
48
  COPY app.py /app/
49
- CMD ["bash", "-c", "python -W ignore -m _asyncio_patch && python app.py"]
50
 
 
 
 
1
  # ================================
2
+ # ✅ Eroha Summarizer PRO v4.5Enterprise Build
 
3
  # ================================
 
4
  FROM python:3.10-slim
5
 
6
+ # --- Environment ---
7
  ENV DEBIAN_FRONTEND=noninteractive \
8
  PYTHONUNBUFFERED=1 \
9
  PYTHONIOENCODING=utf8 \
 
15
  GRADIO_SERVER_NAME=0.0.0.0 \
16
  PYTHONWARNINGS=ignore
17
 
18
+ # --- System dependencies ---
19
  RUN apt-get update && apt-get install -y \
20
  git git-lfs ffmpeg curl wget libgl1 libmagic1 fonts-dejavu-core \
21
  cmake build-essential libprotobuf-dev protobuf-compiler libsentencepiece-dev \
 
24
  WORKDIR /app
25
  RUN mkdir -p /home/user/.cache/huggingface && chmod -R 777 /home/user
26
 
27
+ # --- Python deps ---
28
  COPY requirements.txt /app/
29
  RUN pip install --no-cache-dir -U pip setuptools wheel && \
30
  pip install --no-cache-dir -r /app/requirements.txt && \
31
+ pip install --no-cache-dir tokenizers==0.19.1 sentencepiece==0.2.0 && \
 
32
  pip cache purge
33
 
34
+ # --- Compile SentencePiece manually (native C++) ---
35
+ RUN git clone https://github.com/google/sentencepiece.git /tmp/sentencepiece && \
36
+ cd /tmp/sentencepiece && mkdir build && cd build && \
37
+ cmake .. && make -j $(nproc) && make install && ldconfig && \
38
+ cd / && rm -rf /tmp/sentencepiece
39
+
40
+ # --- Asyncio patch & warnings suppression ---
41
  RUN echo "\
42
+ import warnings, asyncio\n\
43
  def _patched_close(self):\n\
44
  try:\n\
45
  super(asyncio.SelectorEventLoop, self)._close_self_pipe()\n\
 
52
 
53
  EXPOSE 7860
54
  COPY app.py /app/
 
55
 
56
+ # --- Run ---
57
+ CMD ["bash", "-c", "python -W ignore -m _asyncio_patch && python app.py"]