Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
|
|
2 |
import os
|
3 |
import torch
|
4 |
import io
|
|
|
5 |
from pyannote.audio import Pipeline
|
6 |
from pyannote.audio import Audio
|
7 |
from pyannote.core import Segment
|
@@ -11,12 +12,12 @@ pipeline = Pipeline.from_pretrained(
|
|
11 |
use_auth_token=os.environ['api'])
|
12 |
|
13 |
def process_audio(audio):
|
14 |
-
# Extract the audio data from the tuple
|
15 |
-
audio_data,
|
16 |
|
17 |
# Save the uploaded audio file to a temporary location
|
18 |
-
with open("temp.wav", "
|
19 |
-
|
20 |
|
21 |
# Use the diarization pipeline to process the audio
|
22 |
diarization = pipeline("temp.wav")
|
|
|
2 |
import os
|
3 |
import torch
|
4 |
import io
|
5 |
+
import wavio
|
6 |
from pyannote.audio import Pipeline
|
7 |
from pyannote.audio import Audio
|
8 |
from pyannote.core import Segment
|
|
|
12 |
use_auth_token=os.environ['api'])
|
13 |
|
14 |
def process_audio(audio):
|
15 |
+
# Extract the audio data and sample rate from the tuple
|
16 |
+
audio_data, sample_rate = audio
|
17 |
|
18 |
# Save the uploaded audio file to a temporary location
|
19 |
+
with wavio.open("temp.wav", "w", rate=sample_rate, channels=1, sampwidth=2) as wav:
|
20 |
+
wav.write(audio_data)
|
21 |
|
22 |
# Use the diarization pipeline to process the audio
|
23 |
diarization = pipeline("temp.wav")
|