eloi-goncalves commited on
Commit
dc9df02
1 Parent(s): d107a30

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -11,23 +11,18 @@ transcriber.model.config.forced_decoder_ids = (
11
  )
12
  )
13
 
14
- def transcribe(stream, new_chunk):
15
- sr, y = new_chunk
16
  y = y.astype(np.float32)
17
  y /= np.max(np.abs(y))
18
 
19
- if stream is not None:
20
- stream = np.concatenate([stream, y])
21
- else:
22
- stream = y
23
- return stream, transcriber({"sampling_rate": sr, "raw": stream})["text"]
24
 
25
 
26
  demo = gr.Interface(
27
  transcribe,
28
- ["state", gr.Audio(source="microphone", streaming=True)],
29
- ["state", "text"],
30
- live=True,
31
  )
32
 
33
- demo.launch(share=True)
 
11
  )
12
  )
13
 
14
+ def transcribe(audio):
15
+ sr, y = audio
16
  y = y.astype(np.float32)
17
  y /= np.max(np.abs(y))
18
 
19
+ return transcriber({"sampling_rate": sr, "raw": y})["text"]
 
 
 
 
20
 
21
 
22
  demo = gr.Interface(
23
  transcribe,
24
+ gr.Audio(source="microphone"),
25
+ "text",
 
26
  )
27
 
28
+ demo.launch()