Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,50 +1,17 @@
|
|
1 |
-
# # from speechbrain.inference.ASR import EncoderASR
|
2 |
-
# # import gradio as gr
|
3 |
-
|
4 |
-
# # model = EncoderASR.from_hparams("speechbrain/asr-wav2vec2-dvoice-wolof")
|
5 |
-
|
6 |
-
# # def transcribe(audio):
|
7 |
-
# # return model.transcribe_file(audio.name)
|
8 |
-
|
9 |
-
|
10 |
-
# # demo = gr.Interface(fn=transcribe, inputs="file", outputs="text",
|
11 |
-
# # title="Transcription automatique du wolof",
|
12 |
-
# # description="Ce modèle transcrit un fichier audio en wolof en texte en utilisant l'alphabet latin.",
|
13 |
-
# # input_label="Audio en wolof",
|
14 |
-
# # output_label="Transcription alphabet latin"
|
15 |
-
# # )
|
16 |
-
|
17 |
-
# # demo.launch()
|
18 |
-
|
19 |
-
|
20 |
from speechbrain.inference.ASR import EncoderASR
|
21 |
import gradio as gr
|
22 |
-
import numpy as np
|
23 |
|
24 |
-
# Charger le modèle pré-entraîné
|
25 |
model = EncoderASR.from_hparams("speechbrain/asr-wav2vec2-dvoice-wolof")
|
26 |
|
27 |
-
# # Définir la fonction de transcription
|
28 |
-
# def transcribe(audio):
|
29 |
-
# sr, y = audio
|
30 |
-
# y = y.astype(np.float32)
|
31 |
-
# y /= np.max(np.abs(y))
|
32 |
-
|
33 |
-
# # Utiliser le modèle pour transcrire l'audio
|
34 |
-
# return model.transcribe({"sampling_rate": sr, "raw": y})["text"]
|
35 |
-
|
36 |
def transcribe(audio):
|
37 |
return model.transcribe_file(audio.name)
|
38 |
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
)
|
47 |
-
|
48 |
-
# Lancer l'application Gradio
|
49 |
-
asrdemo.launch()
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from speechbrain.inference.ASR import EncoderASR
|
2 |
import gradio as gr
|
|
|
3 |
|
|
|
4 |
model = EncoderASR.from_hparams("speechbrain/asr-wav2vec2-dvoice-wolof")
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
def transcribe(audio):
|
7 |
return model.transcribe_file(audio.name)
|
8 |
|
9 |
|
10 |
+
demo = gr.Interface(fn=transcribe, inputs="file", outputs="text",
|
11 |
+
title="Transcription automatique du wolof",
|
12 |
+
description="Ce modèle transcrit un fichier audio en wolof en texte en utilisant l'alphabet latin.",
|
13 |
+
input_label="Audio en wolof",
|
14 |
+
output_label="Transcription alphabet latin"
|
15 |
+
)
|
|
|
|
|
|
|
|
|
16 |
|
17 |
+
demo.launch()
|