Spaces:
Running
on
Zero
Running
on
Zero
clement-pages
commited on
Commit
·
8919734
1
Parent(s):
a37f1d0
add HF space files
Browse files- .gitattributes +35 -0
- .github/workflows/sync_to_hub.yaml +21 -0
- README.md +14 -0
- app.py +64 -0
- requirements.txt +3 -0
.gitattributes
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
.github/workflows/sync_to_hub.yaml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Sync to Hugging Face hub
|
2 |
+
|
3 |
+
on:
|
4 |
+
push:
|
5 |
+
branches: [main]
|
6 |
+
|
7 |
+
# to run this workflow manually from the Actions tab
|
8 |
+
workflow_dispatch:
|
9 |
+
|
10 |
+
jobs:
|
11 |
+
sync-to-hub:
|
12 |
+
runs-on: ubuntu-latest
|
13 |
+
steps:
|
14 |
+
- uses: actions/checkout@v2
|
15 |
+
with:
|
16 |
+
fetch-depth: 0
|
17 |
+
- name: Push to hub
|
18 |
+
env:
|
19 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
20 |
+
run: git push https://hbredin:$HF_TOKEN@huggingface.co/spaces/pyannote/pretrained-pipelines main --force
|
21 |
+
|
README.md
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Gryannote Audio
|
3 |
+
emoji: 🐢
|
4 |
+
colorFrom: indigo
|
5 |
+
colorTo: blue
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 4.32.1
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
license: mit
|
11 |
+
hf_oauth: true
|
12 |
+
---
|
13 |
+
|
14 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from gryannote_audio import AudioLabeling
|
3 |
+
from gryannote_pipeline import PipelineSelector
|
4 |
+
from gryannote_rttm import RTTM
|
5 |
+
from pyannote.audio import Pipeline
|
6 |
+
import os
|
7 |
+
|
8 |
+
def apply_pipeline(pipeline: Pipeline, audio):
|
9 |
+
"""Apply specified pipeline on the indicated audio file"""
|
10 |
+
annotations = pipeline(audio)
|
11 |
+
|
12 |
+
return ((audio, annotations), (audio, annotations))
|
13 |
+
|
14 |
+
|
15 |
+
def update_annotations(data):
|
16 |
+
return rttm.on_edit(data)
|
17 |
+
|
18 |
+
|
19 |
+
with gr.Blocks() as demo:
|
20 |
+
gr.Markdown(
|
21 |
+
"[Gryannote](): The [pyannote](https://github.com/pyannote/pyannote-audio) audio labeling tool"
|
22 |
+
)
|
23 |
+
|
24 |
+
pipeline_selector = PipelineSelector(token=os.environ["HF_TOKEN"])
|
25 |
+
pipeline_selector.select(
|
26 |
+
fn=pipeline_selector.on_select,
|
27 |
+
inputs=pipeline_selector,
|
28 |
+
outputs=pipeline_selector,
|
29 |
+
preprocess=False,
|
30 |
+
postprocess=False,
|
31 |
+
)
|
32 |
+
pipeline_selector.change(
|
33 |
+
fn=pipeline_selector.on_change,
|
34 |
+
inputs=pipeline_selector,
|
35 |
+
outputs=pipeline_selector,
|
36 |
+
preprocess=False,
|
37 |
+
postprocess=False,
|
38 |
+
)
|
39 |
+
audio_labeling = AudioLabeling(
|
40 |
+
type="filepath",
|
41 |
+
interactive=True,
|
42 |
+
)
|
43 |
+
|
44 |
+
run_btn = gr.Button("Run pipeline")
|
45 |
+
|
46 |
+
rttm = RTTM()
|
47 |
+
|
48 |
+
audio_labeling.edit(
|
49 |
+
fn=update_annotations,
|
50 |
+
inputs=audio_labeling,
|
51 |
+
outputs=rttm,
|
52 |
+
preprocess=False,
|
53 |
+
postprocess=False,
|
54 |
+
)
|
55 |
+
|
56 |
+
run_btn.click(
|
57 |
+
fn=apply_pipeline,
|
58 |
+
inputs=[pipeline_selector, audio_labeling],
|
59 |
+
outputs=[audio_labeling, rttm],
|
60 |
+
)
|
61 |
+
|
62 |
+
|
63 |
+
if __name__ == "__main__":
|
64 |
+
demo.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
pyannote-audio
|
2 |
+
gradio==4.27.0
|
3 |
+
gryannote
|