Spaces:
Build error
Build error
Fix Java installation error - Replace openjdk-8-jdk with default-jdk for Debian bookworm compatibility - OpenJDK 8 not available in Debian bookworm repositories - Use default-jdk which provides OpenJDK 17 (compatible with UFPAlign)
1816301 | # UFPAlign Brazilian Portuguese Speech Alignment Container | |
| FROM kaldiasr/kaldi:latest | |
| LABEL maintainer="UFPAlign Hugging Face Space" | |
| LABEL description="UFPAlign - Brazilian Portuguese Forced Phonetic Alignment Tool" | |
| LABEL version="1.0" | |
| # Set environment variables | |
| ENV UFPALIGN_DIR=/opt/UFPAlign | |
| ENV KALDI_ROOT=/opt/kaldi | |
| ENV LC_ALL=pt_BR.UTF-8 | |
| ENV LANG=pt_BR.UTF-8 | |
| ENV PYTHONPATH=/opt/UFPAlign:$PYTHONPATH | |
| # Update system and install dependencies | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends \ | |
| sudo \ | |
| curl \ | |
| wget \ | |
| default-jdk \ | |
| locales \ | |
| python3-pip \ | |
| python3-dev \ | |
| python3-setuptools \ | |
| build-essential \ | |
| sox \ | |
| ffmpeg \ | |
| git \ | |
| unzip && \ | |
| # Configure locale for Portuguese (Brazil) | |
| sed -i '/pt_BR.UTF-8/s/^# //g' /etc/locale.gen && \ | |
| locale-gen && \ | |
| # Upgrade pip | |
| python3 -m pip install --upgrade pip && \ | |
| # Cleanup | |
| apt-get clean && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Create UFPAlign directory | |
| RUN mkdir -p ${UFPALIGN_DIR} | |
| # Clone UFPAlign repository | |
| RUN cd /opt && \ | |
| git clone https://github.com/falabrasil/ufpalign.git UFPAlign && \ | |
| cd UFPAlign && \ | |
| # Make the shell script executable | |
| chmod +x ufpalign.sh | |
| # Install Python dependencies for UFPAlign and FastAPI | |
| RUN pip install --no-cache-dir \ | |
| fastapi \ | |
| uvicorn \ | |
| python-multipart \ | |
| pydantic \ | |
| textgrid \ | |
| pandas \ | |
| numpy \ | |
| scikit-learn \ | |
| scipy \ | |
| matplotlib | |
| # Install additional UFPAlign Python requirements if they exist | |
| RUN cd ${UFPALIGN_DIR} && \ | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| # Copy application files | |
| COPY app.py /app/app.py | |
| # Create necessary directories | |
| RUN mkdir -p /app/uploads /app/output /app/logs | |
| # Set working directory | |
| WORKDIR /app | |
| # Make sure UFPAlign models and dictionaries are available | |
| RUN cd ${UFPALIGN_DIR} && \ | |
| # Check if demo files exist and are accessible | |
| ls -la demo/ || echo "Demo directory not found" && \ | |
| # Ensure scripts are executable | |
| find . -name "*.sh" -exec chmod +x {} \; | |
| # Expose port | |
| EXPOSE 7860 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ | |
| CMD curl -f http://localhost:7860/health || exit 1 | |
| # Start the application | |
| CMD ["python3", "app.py"] |