Spaces:
Sleeping
Sleeping
File size: 2,728 Bytes
620cefc 109795b 620cefc b2b69ef f414c52 620cefc 6eb33c6 620cefc 6eb33c6 109795b 620cefc 109795b 620cefc 6eb33c6 620cefc f414c52 620cefc f414c52 109795b 620cefc 9d15c30 620cefc f414c52 109795b f414c52 620cefc 109795b f414c52 620cefc f414c52 620cefc f414c52 620cefc f549c64 620cefc 5b507e7 620cefc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# Use a base image with Conda installed
FROM continuumio/miniconda3:latest
WORKDIR /app
COPY *requirements.txt /app/
# Clone the RoLASER repository into the container
RUN apt-get update && \
apt-get install -y g++ && \
apt-get install -y unzip && \
apt-get install -y git && \
git clone https://github.com/lydianish/RoLASER.git /app/RoLASER && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Clone the RoLASER repository into the container
WORKDIR /app/RoLASER
# Create conda environment with the required Python and GCC versions
COPY environment.yml /app/RoLASER/environment.yml
RUN conda env create -f environment.yml && \
echo "conda activate rolaser_env" >> ~/.bashrc
ENV PATH /opt/conda/envs/rolaser_env/bin:$PATH
ENV ROLASER /app/RoLASER
# Install PyTorch 1.10.1
RUN pip3 install --no-cache-dir torch==1.10.1 torchvision==0.11.2 torchaudio==0.10.1 -f https://download.pytorch.org/whl/cu102/torch_stable.html
# Install Fairseq and dependencies
RUN git clone https://github.com/lydianish/fairseq.git /app/fairseq && \
cd /app/fairseq && \
git checkout rolaser && \
pip3 install --no-cache-dir --editable . && \
python3 setup.py build_ext --inplace && \
pip3 install --no-cache-dir -r /app/FAIRSEQ_requirements.txt
ENV FAIRSEQ /app/fairseq
# Install LASER and dependencies
RUN git clone https://github.com/lydianish/LASER.git /app/LASER
WORKDIR /app/LASER
ENV LASER /app/LASER
RUN git checkout rolaser && \
bash ./install_external_tools.sh && \
pip3 install --no-cache-dir -r /app/LASER_requirements.txt
# Install other RoLASER dependencies
WORKDIR /app/RoLASER
RUN pip3 install --no-cache-dir -r /app/ROLASER_requirements.txt
# Download models
WORKDIR /app/RoLASER/models
RUN wget https://zenodo.org/api/records/10864557/files-archive && \
unzip files-archive && \
mkdir $LASER/models && \
mv laser* $LASER/models && \
rm files-archive
# Set Python system path to find the Fairseq and LASER modules
ENV PYTHONPATH $PYTHONPATH:$FAIRSEQ
ENV PYTHONPATH $PYTHONPATH:$LASER/source
# Create a non-root user named "user" with user ID 1000
RUN useradd -m -u 1000 user
RUN chown user:user -R /app/
# Switch to the non-root user
USER user
# Set home to the user's home directory
ENV HOME /home/user
ENV PATH $HOME/.local/bin:$PATH
WORKDIR $HOME
RUN mkdir app
# Set the working directory to the user's home directory
WORKDIR $HOME/app
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
COPY --chown=user:user . $HOME/app
EXPOSE 8501
CMD streamlit run app.py \
--server.headless true \
--server.enableCORS false \
--server.enableXsrfProtection false \
--server.fileWatcherType none |