a.pourmand commited on
Commit
16a3aec
1 Parent(s): 7cce5b7
Files changed (4) hide show
  1. Dockerfile +59 -0
  2. app.py +28 -0
  3. packages.txt +1 -0
  4. requirements.txt +4 -0
Dockerfile ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM nvidia/cuda:11.7.1-cudnn8-devel-ubuntu22.04
2
+ ENV DEBIAN_FRONTEND=noninteractive
3
+ RUN apt-get update && \
4
+ apt-get upgrade -y && \
5
+ apt-get install -y --no-install-recommends \
6
+ git \
7
+ git-lfs \
8
+ wget \
9
+ curl \
10
+ # python build dependencies \
11
+ build-essential \
12
+ libssl-dev \
13
+ zlib1g-dev \
14
+ libbz2-dev \
15
+ libreadline-dev \
16
+ libsqlite3-dev \
17
+ libncursesw5-dev \
18
+ xz-utils \
19
+ tk-dev \
20
+ libxml2-dev \
21
+ libxmlsec1-dev \
22
+ libffi-dev \
23
+ liblzma-dev \
24
+ # gradio dependencies \
25
+ ffmpeg \
26
+ # fairseq2 dependencies \
27
+ libsndfile-dev && \
28
+ apt-get clean && \
29
+ rm -rf /var/lib/apt/lists/*
30
+
31
+ RUN useradd -m -u 1000 user
32
+ USER user
33
+ ENV HOME=/home/user \
34
+ PATH=/home/user/.local/bin:${PATH}
35
+ WORKDIR ${HOME}/app
36
+
37
+ RUN curl https://pyenv.run | bash
38
+ ENV PATH=${HOME}/.pyenv/shims:${HOME}/.pyenv/bin:${PATH}
39
+ ARG PYTHON_VERSION=3.10.12
40
+ RUN pyenv install ${PYTHON_VERSION} && \
41
+ pyenv global ${PYTHON_VERSION} && \
42
+ pyenv rehash && \
43
+ pip install --no-cache-dir -U pip setuptools wheel
44
+
45
+ COPY --chown=1000 ./requirements.txt /tmp/requirements.txt
46
+ RUN pip install --no-cache-dir --upgrade -r /tmp/requirements.txt
47
+
48
+ COPY --chown=1000 . ${HOME}/app
49
+ ENV PYTHONPATH=${HOME}/app \
50
+ PYTHONUNBUFFERED=1 \
51
+ GRADIO_ALLOW_FLAGGING=never \
52
+ GRADIO_NUM_PORTS=1 \
53
+ GRADIO_SERVER_NAME=0.0.0.0 \
54
+ GRADIO_THEME=huggingface \
55
+ SYSTEM=spaces \
56
+ GRADIO_SERVER_PORT=7860
57
+ EXPOSE 7860
58
+
59
+ CMD ["python", "app.py"]
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import os
3
+
4
+ HF_API = os.getenv("HF_API")
5
+ API_URL = os.getenv("API_URL") # path to Seamlessm4t API endpoint
6
+
7
+ DESCRIPTION = """
8
+ # Seamlessm4t + Speaker Diarization + Voice Activity Detection
9
+ Here we use seamlessm4t to generate captions for full audios. Audio can be of arbitrary length. """
10
+
11
+ DUPLICATE = """
12
+ To duplicate this repo, you have to give permission from three reopsitories and accept all user conditions:
13
+ 1- https://huggingface.co/pyannote/voice-activity-detection
14
+ 2- hf.co/pyannote/segmentation
15
+ 3- hf.co/pyannote/speaker-diarization
16
+ """
17
+
18
+
19
+ with gr.Blocks() as demo:
20
+ gr.Markdown(DESCRIPTION)
21
+ target_language = gr.Dropdown(choices=["French", "Spanish", "German"])
22
+ audio_source = gr.Radio(choices=["microphone", "file"])
23
+ mic_input = gr.Audio(source="microphone", visible=False)
24
+ file_input = gr.Audio(source="upload", visible=False)
25
+ output = gr.Textbox()
26
+ gr.Markdown(DUPLICATE)
27
+
28
+ demo.queue(max_size=50).launch()
packages.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ ffmpeg
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ pyannote.audio
2
+ pydub
3
+ gradio_client
4
+ gradio