thanhkt commited on
Commit
fbd4c25
·
verified ·
1 Parent(s): 21d0e02

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -4
Dockerfile CHANGED
@@ -49,8 +49,9 @@ ENV PATH="/root/.TinyTeX/bin/x86_64-linux:$PATH"
49
 
50
  # Copy requirements and install Python dependencies
51
  COPY requirements.txt .
52
- RUN pip install --no-cache-dir -r requirements.txt \
53
- && pip install --no-cache-dir gradio \
 
54
  && python -c "import gradio; print(f'Gradio version: {gradio.__version__}')" \
55
  && find /usr/local -name "*.pyc" -delete \
56
  && find /usr/local -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true
@@ -69,15 +70,16 @@ RUN mkdir -p models && cd models \
69
  # Copy all project files and folders
70
  COPY . .
71
 
 
 
 
72
  # Ensure all files are writable (fix PermissionError for log file)
73
  RUN chmod -R a+w /app
74
 
75
  # Create output directory
76
  RUN mkdir -p output tmp
77
-
78
  # Ensure output and tmp directories are writable (fix PermissionError for session_id.txt)
79
  RUN chmod -R a+w /app/output /app/tmp || true
80
-
81
  # Add HF Spaces specific metadata
82
  LABEL space.title="Text 2 Mnaim" \
83
  space.sdk="docker" \
 
49
 
50
  # Copy requirements and install Python dependencies
51
  COPY requirements.txt .
52
+ RUN pip install --no-cache-dir -r requirements.txt \
53
+ && pip uninstall -y torch torchvision torchaudio \
54
+ && pip install --no-cache-dir torch+cpu torchvision+cpu torchaudio+cpu --index-url https://download.pytorch.org/whl/cpu \
55
  && python -c "import gradio; print(f'Gradio version: {gradio.__version__}')" \
56
  && find /usr/local -name "*.pyc" -delete \
57
  && find /usr/local -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true
 
70
  # Copy all project files and folders
71
  COPY . .
72
 
73
+ # Run embedding creation script at build time
74
+ RUN python create_embeddings.py
75
+
76
  # Ensure all files are writable (fix PermissionError for log file)
77
  RUN chmod -R a+w /app
78
 
79
  # Create output directory
80
  RUN mkdir -p output tmp
 
81
  # Ensure output and tmp directories are writable (fix PermissionError for session_id.txt)
82
  RUN chmod -R a+w /app/output /app/tmp || true
 
83
  # Add HF Spaces specific metadata
84
  LABEL space.title="Text 2 Mnaim" \
85
  space.sdk="docker" \