lewtun HF staff commited on
Commit
66fd0a1
β€’
1 Parent(s): 82bbb9f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -2,14 +2,17 @@ import gradio as gr
2
  import numpy as np
3
  from datasets import load_dataset
4
 
5
- speech_commands = load_dataset("speech_commands", "v0.02", split="test")
6
- id2label = speech_commands.features["label"].int2str
7
 
8
 
9
  def generate_audio():
10
- example = speech_commands.shuffle()[0]
11
  audio = example["audio"]
12
- return (audio["sampling_rate"], (audio["array"] * 32_767).astype(np.int16)), id2label(example["label"])
 
 
 
13
 
14
 
15
  with gr.Blocks() as demo:
 
2
  import numpy as np
3
  from datasets import load_dataset
4
 
5
+ minds = load_dataset("PolyAI/minds14", name="en-AU", split="train")
6
+ id2label = minds.features["intent_class"].int2str
7
 
8
 
9
  def generate_audio():
10
+ example = minds.shuffle()[0]
11
  audio = example["audio"]
12
+ return (
13
+ audio["sampling_rate"],
14
+ audio["array"],
15
+ ), id2label(example["intent_class"])
16
 
17
 
18
  with gr.Blocks() as demo: