Spaces:
Sleeping
Sleeping
eloi-goncalves
commited on
Commit
•
dc9df02
1
Parent(s):
d107a30
Update app.py
Browse files
app.py
CHANGED
@@ -11,23 +11,18 @@ transcriber.model.config.forced_decoder_ids = (
|
|
11 |
)
|
12 |
)
|
13 |
|
14 |
-
def transcribe(
|
15 |
-
sr, y =
|
16 |
y = y.astype(np.float32)
|
17 |
y /= np.max(np.abs(y))
|
18 |
|
19 |
-
|
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 |
-
|
29 |
-
|
30 |
-
live=True,
|
31 |
)
|
32 |
|
33 |
-
demo.launch(
|
|
|
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()
|