Streamlit Docker app runs very slowly
Hi,I have a Docker Streamlit app that runs perfectly fine/fast locally or on AWS Fargate but runs very slowly on a Hugging Face space (CPU UPGRADE). The build is successful and all pages work fine, it is just very slow!The app reads a small data sample from an AWS S3 bucket located in Australia so I do expect additional region latency once deployed on Hugging Face, but not as much as the 10x that I’m observing…This is a private space so cannot link to the codebase but below is the Dockerfile:FROM python:3.10

WORKDIR /app

# install git-lfs
RUN apt-get update && apt-get install -y \
    git-lfs \
    && rm -rf /var/lib/apt/lists/* \
    && git lfs install

# install the AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
    && unzip awscliv2.zip \
    && ./aws/install \
    && rm -rf awscliv2.zip aws

# install the app Python dependencies
COPY requirements.txt ./requirements.txt
RUN pip3 install  --no-cache-dir --upgrade -r requirements.txt

# create a non-root user
RUN useradd -m -u 1000 user
USER user
ENV HOME /home/user
ENV PATH $HOME/.local/bin:$PATH

# expose secrets as environment variables
RUN --mount=type=secret,id=GC_PROJECT,mode=0444,required=true \
  export GC_PROJECT=$(cat /run/secrets/GC_PROJECT)
RUN --mount=type=secret,id=GC_SA_ENCODED_KEY,mode=0444,required=true \
  export GC_SA_ENCODED_KEY=$(cat /run/secrets/GC_SA_ENCODED_KEY)
RUN --mount=type=secret,id=AWS_ACCESS_KEY_ID,mode=0444,required=true \
  export AWS_ACCESS_KEY_ID=$(cat /run/secrets/AWS_ACCESS_KEY_ID)
RUN --mount=type=secret,id=AWS_SECRET_ACCESS_KEY,mode=0444,required=true \
  export AWS_SECRET_ACCESS_KEY=$(cat /run/secrets/AWS_SECRET_ACCESS_KEY)
RUN --mount=type=secret,id=AWS_REGION,mode=0444,required=true \
  export AWS_REGION=$(cat /run/secrets/AWS_REGION)

# configure outerbounds
RUN --mount=type=secret,id=OUTERBOUNDS_SERVICE_TOKEN,mode=0444,required=true \
  outerbounds configure $(cat /run/secrets/OUTERBOUNDS_SERVICE_TOKEN)

# copy the app files
WORKDIR $HOME
RUN mkdir app
WORKDIR $HOME/app
COPY ./pages ./pages
COPY ./utils ./utils
COPY ./config.py ./config.py
COPY ./app.py ./app.py

# run the app
EXPOSE 8501
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
CMD streamlit run app.py \
    --server.headless true \
    --server.enableCORS false \
    --server.enableXsrfProtection false \
    --server.fileWatcherType none \
    --browser.gatherUsageStats false \
    --server.maxUploadSize 200