vonewman commited on
Commit
276af25
1 Parent(s): 31f35ea

Create new file

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import time
3
+
4
+ from transformers import pipeline
5
+
6
+ p = pipeline("automatic-speech-recognition",
7
+ model="abdouaziiz/wav2vec2-xls-r-300m-wolof-lm")
8
+
9
+ def transcribe(audio, state=""):
10
+ """Une fonction pour transformer un audio en Wolof en Text."""
11
+ time.sleep(3)
12
+ text = p(audio)["text"]
13
+ state += text + " "
14
+ return state, state
15
+
16
+ iface = gr.Interface(
17
+ fn=transcribe,
18
+ inputs = [
19
+ gr.inputs.Audio(source="microphone", type="filepath"),
20
+ "state"
21
+ ],
22
+ outputs = [
23
+ "textbox",
24
+ "state"
25
+ ],
26
+ live=True
27
+ )
28
+
29
+ iface.launch(inline = False)