File size: 573 Bytes
173f818
 
 
 
66fd0a1
 
173f818
 
 
66fd0a1
173f818
66fd0a1
 
 
 
173f818
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
import numpy as np
from datasets import load_dataset

minds = load_dataset("PolyAI/minds14", name="en-AU", split="train")
id2label = minds.features["intent_class"].int2str


def generate_audio():
    example = minds.shuffle()[0]
    audio = example["audio"]
    return (
        audio["sampling_rate"],
        audio["array"],
    ), id2label(example["intent_class"])


with gr.Blocks() as demo:
    with gr.Column():
        for _ in range(4):
            audio, label = generate_audio()
            output = gr.Audio(audio, label=label)

demo.launch()