import gradio as gr from pyannote.audio import Pipeline def diarization(audio): pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization") output = pipeline(audio) answer = "" for turn, _, speaker in output.itertracks(yield_label=True): answer += "{} said something starting from {} and ends on {}\n".format(speaker,turn.start,turn.end) return answer app = gr.Interface(fn=diarization, inputs=gr.inputs.Audio(source="upload", type="filepath", label="audio"), outputs="text") app.launch()