Delik's picture
Update app.py
f60dd49 verified
raw
history blame
822 Bytes
import gradio as gr
import os
import torch
import io
from pyannote.audio import Pipeline
from pyannote.audio import Audio
from pyannote.audio.pipelines.utils.hook import TimingHook
from pyannote.core import Segment
pipeline = Pipeline.from_pretrained(
"pyannote/speaker-diarization-3.1",
use_auth_token=os.environ['api'])
def process_audio(audio):
# Use the diarization pipeline to process the audio
diarization = pipeline(audio)
# Return the diarization output
return diarization
with gr.Blocks() as demo:
audio_input = gr.Audio(label="Upload Audio") # Remove source="upload"
process_button = gr.Button("Process")
diarization_output = gr.JSON(label="Diarization Output")
process_button.click(fn=process_audio, inputs=audio_input, outputs=diarization_output)
demo.launch()