Spaces:
Running
on
Zero
Running
on
Zero
clement-pages
commited on
Commit
·
659de25
1
Parent(s):
8c4d3ba
update app
Browse files
app.py
CHANGED
|
@@ -4,12 +4,13 @@ from gryannote_audio import AudioLabeling
|
|
| 4 |
from gryannote_rttm import RTTM
|
| 5 |
from pyannote.audio import Pipeline
|
| 6 |
import os
|
|
|
|
| 7 |
|
| 8 |
@spaces.GPU(duration=300)
|
| 9 |
def apply_pipeline(audio):
|
| 10 |
"""Apply specified pipeline on the indicated audio file"""
|
| 11 |
pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization-3.1", use_auth_token=os.environ["HF_TOKEN"])
|
| 12 |
-
pipeline.to("cuda")
|
| 13 |
annotations = pipeline(audio)
|
| 14 |
|
| 15 |
return ((audio, annotations), (audio, annotations))
|
|
@@ -18,7 +19,7 @@ def apply_pipeline(audio):
|
|
| 18 |
def update_annotations(data):
|
| 19 |
return rttm.on_edit(data)
|
| 20 |
|
| 21 |
-
|
| 22 |
with gr.Blocks() as demo:
|
| 23 |
with gr.Row():
|
| 24 |
with gr.Column():
|
|
|
|
| 4 |
from gryannote_rttm import RTTM
|
| 5 |
from pyannote.audio import Pipeline
|
| 6 |
import os
|
| 7 |
+
import torch
|
| 8 |
|
| 9 |
@spaces.GPU(duration=300)
|
| 10 |
def apply_pipeline(audio):
|
| 11 |
"""Apply specified pipeline on the indicated audio file"""
|
| 12 |
pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization-3.1", use_auth_token=os.environ["HF_TOKEN"])
|
| 13 |
+
pipeline.to(torch.device("cuda"))
|
| 14 |
annotations = pipeline(audio)
|
| 15 |
|
| 16 |
return ((audio, annotations), (audio, annotations))
|
|
|
|
| 19 |
def update_annotations(data):
|
| 20 |
return rttm.on_edit(data)
|
| 21 |
|
| 22 |
+
|
| 23 |
with gr.Blocks() as demo:
|
| 24 |
with gr.Row():
|
| 25 |
with gr.Column():
|