Spaces:
Sleeping
Sleeping
Using modified user permissions
Browse files- Dockerfile +12 -9
- main.py +1 -1
Dockerfile
CHANGED
@@ -11,23 +11,26 @@ RUN bash ./models/download-ggml-model.sh "${model}"
|
|
11 |
RUN make main
|
12 |
|
13 |
FROM python:3.10 as whisper
|
14 |
-
|
15 |
RUN apt-get update \
|
16 |
&& apt-get install -y libsdl2-dev alsa-utils ffmpeg \
|
17 |
&& apt-get clean \
|
18 |
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
COPY
|
|
|
24 |
|
25 |
-
WORKDIR /root
|
26 |
ARG model=base
|
27 |
ENV model=$model
|
28 |
-
RUN mkdir /root/models
|
29 |
RUN mkdir -p -m 777 /tmp/holosubs/results
|
30 |
-
COPY --from=build "/whisper/models/ggml-${model}.bin" "/root/models/ggml-${model}.bin"
|
31 |
COPY --from=build /whisper/main /usr/local/bin/whisper
|
32 |
|
33 |
-
CMD ["
|
|
|
11 |
RUN make main
|
12 |
|
13 |
FROM python:3.10 as whisper
|
|
|
14 |
RUN apt-get update \
|
15 |
&& apt-get install -y libsdl2-dev alsa-utils ffmpeg \
|
16 |
&& apt-get clean \
|
17 |
&& rm -rf /var/lib/apt/lists/*
|
18 |
+
RUN useradd -m -u 1000 user
|
19 |
+
USER user
|
20 |
+
ENV HOME=/home/user \
|
21 |
+
PATH=/home/user/.local/bin:$PATH
|
22 |
|
23 |
+
WORKDIR $HOME/root
|
24 |
+
COPY --chown=user requirements.txt $HOME/root
|
25 |
+
RUN pip install -r $HOME/root/requirements.txt
|
26 |
+
COPY --chown=user main.py $HOME/root
|
27 |
+
COPY --chown=user youtubeaudio.py $HOME/root
|
28 |
|
|
|
29 |
ARG model=base
|
30 |
ENV model=$model
|
31 |
+
RUN mkdir $HOME/root/models
|
32 |
RUN mkdir -p -m 777 /tmp/holosubs/results
|
33 |
+
COPY --from=build "/whisper/models/ggml-${model}.bin" "${HOME}/root/models/ggml-${model}.bin"
|
34 |
COPY --from=build /whisper/main /usr/local/bin/whisper
|
35 |
|
36 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
main.py
CHANGED
@@ -28,7 +28,7 @@ def read_root(url: Url):
|
|
28 |
# Generate subtitles
|
29 |
output_file=os.path.join("/tmp/holosubs/results", str(uuid.uuid4()))
|
30 |
logging.info(f'Writing to file {output_file}.vtt')
|
31 |
-
cmd=['/usr/local/bin/whisper','-m',f'/root/models/ggml-{MODEL}.bin'
|
32 |
,'-f',filename, '-di', '-of', output_file, '-tr', '-ovtt', '-t', '8']
|
33 |
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
34 |
(output, err) = p.communicate()
|
|
|
28 |
# Generate subtitles
|
29 |
output_file=os.path.join("/tmp/holosubs/results", str(uuid.uuid4()))
|
30 |
logging.info(f'Writing to file {output_file}.vtt')
|
31 |
+
cmd=['/usr/local/bin/whisper','-m',f'/home/user/root/models/ggml-{MODEL}.bin'
|
32 |
,'-f',filename, '-di', '-of', output_file, '-tr', '-ovtt', '-t', '8']
|
33 |
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
34 |
(output, err) = p.communicate()
|