File size: 2,584 Bytes
3ccf12e
 
 
 
20f05ab
2b28d4e
e4a50e0
 
 
3ccf12e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20f05ab
86e8fc1
3ccf12e
 
 
 
2465ef1
 
3ccf12e
1d2a32a
3ccf12e
 
20f05ab
86e8fc1
20f05ab
 
3ccf12e
 
2d0b13d
86e8fc1
3ccf12e
 
 
 
 
20f05ab
86e8fc1
3ccf12e
 
 
20f05ab
 
a5e19ff
22ef630
 
 
 
208fa1c
3ccf12e
20f05ab
1af1777
3ccf12e
 
 
20f05ab
13c174c
3ccf12e
0855034
 
22ef630
0855034
 
 
 
 
 
22ef630
 
75836d7
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
85
86
87
88
89
90
# Use an official Python runtime as a parent image
FROM python:3.8

# Set the working directory in the container
WORKDIR /app
ENV HYDRA_FULL_ERROR="1"
# Install Python dependencies
COPY ./requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Install system dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    cmake \
    curl \
    ca-certificates \
    gcc \
    git \
    git-lfs \
    wget \
    libpq-dev \
    libsndfile1-dev \
    libgl1 \
    unzip \
    libjpeg-dev \
    libpng-dev \
    libgomp1 \
    && rm -rf /var/lib/apt/lists/* \
    && apt-get clean

WORKDIR /app
#COPY --chown=user . $HOME/app
# Create .streamlit/config.toml file
RUN mkdir -p /app/.streamlit && \
    echo "[server]\nenableXsrfProtection = false\nenableCORS = false" > /app/.streamlit/config.toml

# Create folder
WORKDIR /app/text-remove
# Clone the repository
RUN git clone https://github.com/nguyen-brat/text-remove.git .

# Set the working directory to the cloned repo
WORKDIR /app/text-remove
#COPY --chown=user . $HOME/app/text-remove
RUN mkdir -p /app/text-remove/.streamlit && \
    echo "[server]\nenableXsrfProtection = false\nenableCORS = false" > /app/text-remove/.streamlit/config.toml

# Set up Craft
WORKDIR /app/text-remove/craft_pytorch
#COPY --chown=user . $HOME/app/text-remove/CRAFT-pytorch
RUN wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1Jk4eGD7crsqCCg9C9VjCLkMN3ze8kutZ' -O "craft_mlt_25k.pth"
RUN pip install gdown
RUN gdown 1XSaFwBkOaFOdtk4Ane3DFyJGPRw6v5bO

# Set up lama
WORKDIR /app/text-remove/lama
#COPY --chown=user . $HOME/app/text-remove/lama
RUN curl -LJO https://huggingface.co/smartywu/big-lama/resolve/main/big-lama.zip
RUN unzip big-lama.zip

#RUN chmod 777 app/text-remove/target_test
#RUN chmod 777 app/text-remove/test_folder

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

# Set the working directory back to the root of the project
WORKDIR /app/text-remove

# Make port 7860 available to the world outside this container
EXPOSE 7860

ENV PYTHONPATH=/app/text-remove

# Run app.py when the container launches
ENTRYPOINT ["streamlit", "run"]
CMD ["app.py", "--server.port=7860", "--server.headless=true", "--server.enableCORS=false", "--server.enableXsrfProtection=false", "--server.fileWatcherType=none"]

#CMD streamlit run app.py \
#    ---server.port=7860 \
#    --server.headless true \
#    --server.enableCORS false \
#    --server.enableXsrfProtection false \
#    --server.fileWatcherType none