CoolFace
Apppublic

Gaadwhin/speech_to_text_api

sourceHugging Faceupdated 1y agoView on Hugging Face
1likes
Dockerfile46 linesDownload Raw Back to root
1# Use a Python base image that is compatible with your app2FROM python:3.10-slim3 4# Install ffmpeg and other necessary system packages5# apt-get update is crucial before installing new packages6# ffmpeg is the package name for the ffmpeg binary7# && rm -rf /var/lib/apt/lists/* helps keep the image size down by cleaning up apt caches8RUN apt-get update && apt-get install -y \9    ffmpeg \10    && rm -rf /var/lib/apt/lists/*11 12# Set environment variables13ENV PYTHONDONTWRITEBYTECODE=114ENV PYTHONUNBUFFERED=115ENV XDG_CACHE_HOME=/data16ENV HF_HOME=/data/.hf_cache17 18# Set work directory19WORKDIR /app20 21# Install dependencies22# COPY requirements.txt . copies the requirements file into the container23# pip install --upgrade pip ensures pip is up-to-date24# pip install -r requirements.txt installs all listed Python packages25COPY requirements.txt .26RUN pip install --upgrade pip && pip install -r requirements.txt27 28# Preload the Whisper model to reduce startup time29# This downloads the 'tiny' model into the HF_HOME cache directory during build30RUN python -c "import whisper; whisper.load_model('tiny')"31 32# Copy application code33# COPY . . copies all other files from your local directory into the /app directory in the container34COPY . .35 36# Expose port for the Space37# EXPOSE 7860 informs Docker that the container listens on the specified network ports at runtime.38# This works in conjunction with the app_port in README.md39EXPOSE 786040 41# Start the FastAPI app42# CMD defines the command to run when the container starts43# uvicorn app:app tells Uvicorn to run the 'app' FastAPI instance from 'app.py'44# --host 0.0.0.0 makes the app accessible from outside the container45# --port 7860 ensures it listens on the port specified in README.md46CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]