amirjamali commited on
Commit
7eb21f1
·
unverified ·
1 Parent(s): 094ee23

Improve Dockerfile for better network reliability and enhance README with YouTube authentication troubleshooting

Browse files
Files changed (2) hide show
  1. Dockerfile +10 -7
  2. README.md +20 -0
Dockerfile CHANGED
@@ -2,13 +2,10 @@ FROM python:3.9-slim
2
 
3
  WORKDIR /app
4
 
5
- # Set DNS to improve network connectivity during build
6
- # Using Google DNS servers for better reliability
7
- RUN echo "nameserver 8.8.8.8" > /etc/resolv.conf && \
8
- echo "nameserver 8.8.4.4" >> /etc/resolv.conf
9
-
10
  # Install system dependencies including ffmpeg for audio processing
11
- RUN apt-get update && apt-get install -y \
 
 
12
  build-essential \
13
  curl \
14
  software-properties-common \
@@ -19,9 +16,15 @@ RUN apt-get update && apt-get install -y \
19
  && apt-get clean \
20
  && rm -rf /var/lib/apt/lists/*
21
 
 
 
 
 
22
  # Copy requirements and install Python dependencies
23
  COPY requirements.txt ./
24
- RUN pip3 install --no-cache-dir -r requirements.txt
 
 
25
 
26
  # Copy source code
27
  COPY src/ ./src/
 
2
 
3
  WORKDIR /app
4
 
 
 
 
 
 
5
  # Install system dependencies including ffmpeg for audio processing
6
+ # Add retry logic and better mirrors for improved network reliability
7
+ RUN apt-get update --allow-releaseinfo-change || (sleep 2 && apt-get update) && \
8
+ apt-get install -y \
9
  build-essential \
10
  curl \
11
  software-properties-common \
 
16
  && apt-get clean \
17
  && rm -rf /var/lib/apt/lists/*
18
 
19
+ # Set pip to have more retries and timeout
20
+ ENV PIP_DEFAULT_TIMEOUT=100
21
+ ENV PIP_RETRIES=3
22
+
23
  # Copy requirements and install Python dependencies
24
  COPY requirements.txt ./
25
+ RUN pip install --upgrade pip && \
26
+ pip install --no-cache-dir -r requirements.txt || \
27
+ (sleep 2 && pip install --no-cache-dir -r requirements.txt)
28
 
29
  # Copy source code
30
  COPY src/ ./src/
README.md CHANGED
@@ -38,6 +38,26 @@ This app analyzes a speaker's English accent from video URLs or audio uploads, p
38
  - Click "Analyze Audio"
39
  - View the results
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  ## Technology Stack
42
  - **Audio Processing**: FFmpeg, Librosa
43
  - **ML Models**: SpeechBrain, Transformers
 
38
  - Click "Analyze Audio"
39
  - View the results
40
 
41
+ ### Troubleshooting YouTube Authentication Issues
42
+
43
+ If you encounter errors like `Sign in to confirm you're not a bot` when using YouTube videos:
44
+
45
+ 1. **Use a different video source**:
46
+ - Try using Loom, Vimeo, or direct MP4 links instead of YouTube
47
+
48
+ 2. **Using cookies for YouTube authentication**:
49
+ - The app supports uploading a cookies.txt file for YouTube authentication
50
+ - You can export cookies from your browser using browser extensions like "Get cookies.txt"
51
+ - Or use yt-dlp's built-in browser cookie extraction:
52
+ ```
53
+ # Install yt-dlp if you don't have it
54
+ pip install yt-dlp
55
+
56
+ # Extract cookies from your browser (replace chrome with your browser)
57
+ yt-dlp --cookies-from-browser chrome -o cookies.txt https://youtube.com
58
+ ```
59
+ - Upload the generated cookies file in the app interface
60
+
61
  ## Technology Stack
62
  - **Audio Processing**: FFmpeg, Librosa
63
  - **ML Models**: SpeechBrain, Transformers