Sidoineko commited on
Commit
db1f1cd
·
1 Parent(s): e8c6615

Supprime app.py pour forcer l'utilisation du Dockerfile sur Hugging Face Spaces

Browse files
Files changed (2) hide show
  1. Dockerfile +8 -10
  2. app.py +0 -32
Dockerfile CHANGED
@@ -11,19 +11,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
11
  COPY requirements.txt .
12
  RUN pip install --no-cache-dir -r requirements.txt
13
 
14
- # Installation de PyTorch
15
- RUN pip install --no-cache-dir --timeout=600 \
16
- torch==2.0.1+cpu \
17
- torchvision==0.15.2+cpu \
18
  -f https://download.pytorch.org/whl/torch_stable.html
19
 
 
 
 
20
  # Copie du code source
21
  COPY . .
22
 
23
- # Configuration des variables d'environnement
24
- ENV STREAMLIT_SERVER_PORT=8501
25
- ENV STREAMLIT_SERVER_HEADLESS=true
26
- ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
27
 
28
- # Commande de démarrage
29
- CMD ["python", "app.py"]
 
11
  COPY requirements.txt .
12
  RUN pip install --no-cache-dir -r requirements.txt
13
 
14
+ # Installer torch/torchvision et opencv-python-headless AVANT le reste
15
+ RUN pip install --no-cache-dir --default-timeout=600 \
16
+ torch==2.0.1+cpu torchvision==0.15.2+cpu opencv-python-headless==4.11.0.86 \
 
17
  -f https://download.pytorch.org/whl/torch_stable.html
18
 
19
+ # Installer le reste des dépendances
20
+ RUN pip install --no-cache-dir --default-timeout=600 -r requirements.txt -i https://pypi.org/simple
21
+
22
  # Copie du code source
23
  COPY . .
24
 
25
+ WORKDIR /app
 
 
 
26
 
27
+ CMD ["streamlit", "run", "src/streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"]
 
app.py DELETED
@@ -1,32 +0,0 @@
1
- import subprocess
2
- import os
3
- import sys
4
-
5
- print("=== Démarrage du serveur Streamlit ===")
6
- print(f"Python version: {sys.version}")
7
- print(f"Working directory: {os.getcwd()}")
8
- print("Contenu du répertoire courant:")
9
- os.system("ls -la")
10
- print("\nContenu du dossier src:")
11
- os.system("ls -la src/")
12
-
13
- try:
14
- os.chdir("src")
15
- print("\n=== Lancement de Streamlit ===")
16
- subprocess.run([
17
- "streamlit",
18
- "run",
19
- "streamlit_app.py",
20
- "--server.port=8501",
21
- "--server.address=0.0.0.0",
22
- "--server.headless=true",
23
- "--server.enableCORS=false",
24
- "--server.enableXsrfProtection=false"
25
- ], check=True)
26
- except Exception as e:
27
- print(f"Erreur: {str(e)}")
28
- print("\n=== Stack Trace ===")
29
- import traceback
30
- traceback.print_exc()
31
- # Garder le conteneur en vie pour voir les logs
32
- input("Appuyez sur Entrée pour quitter...")