File size: 1,429 Bytes
6f72ac3
 
 
 
7c5d357
6f72ac3
 
43180c3
6f72ac3
 
7c5d357
1f7bdfa
6f72ac3
43180c3
db1f1cd
43180c3
e8c6615
 
b3870a9
 
 
911335c
 
 
db1f1cd
 
 
7c5d357
6f72ac3
 
30d0dfc
 
 
0ac53ba
 
db1f1cd
6f72ac3
5ee9f94
 
 
 
84700eb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
FROM python:3.11-slim

WORKDIR /app

# Installation des dépendances système
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    git \
    && rm -rf /var/lib/apt/lists/*

# Copie des requirements d'abord pour le cache Docker
COPY requirements.txt .

# Installer PyTorch et torchvision AVANT le reste
RUN pip install --no-cache-dir --default-timeout=600 \
    torch>=2.1.0 torchvision>=0.16.0 \
    -f https://download.pytorch.org/whl/torch_stable.html

# Installer timm pour les modèles de vision
RUN pip install --no-cache-dir timm>=0.9.0

# Installer Gemini API
RUN pip install --no-cache-dir google-generativeai>=0.3.0

# Installer le reste des dépendances
RUN pip install --no-cache-dir --default-timeout=600 -r requirements.txt -i https://pypi.org/simple

# Copie du code source
COPY . .

# Créer le dossier cache Hugging Face et donner les droits d'écriture
RUN mkdir -p /app/cache/huggingface && chmod -R 777 /app/cache/huggingface
ENV HF_HOME=/app/cache/huggingface

# Configuration Streamlit
WORKDIR /app

# Copier la configuration spécifique pour Hugging Face Spaces
COPY .streamlit/config_hf.toml .streamlit/config.toml

# Commande de démarrage - VERSION MULTILINGUE avec configuration optimisée
CMD ["streamlit", "run", "src/streamlit_app_stable.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.enableCORS=false", "--server.enableXsrfProtection=false"]