Spaces:
Runtime error
Runtime error
Update app.py
Browse filesAdded French and Japanese
app.py
CHANGED
@@ -5,6 +5,8 @@ import time
|
|
5 |
p = pipeline("automatic-speech-recognition",model="jonatasgrosman/wav2vec2-large-xlsr-53-spanish")
|
6 |
pc = pipeline("automatic-speech-recognition",model="softcatala/wav2vec2-large-xlsr-catala")
|
7 |
pe = pipeline("automatic-speech-recognition",model="jonatasgrosman/wav2vec2-large-xlsr-53-english")
|
|
|
|
|
8 |
|
9 |
|
10 |
|
@@ -20,6 +22,12 @@ def transcribe(language,audio, state=""):#language="Spanish",
|
|
20 |
if language=="English":
|
21 |
state=""
|
22 |
text = pe(audio)["text"]
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
state += text + " "
|
24 |
#text2="Esto es loq ue te he entendido"
|
25 |
return state, state
|
@@ -31,7 +39,7 @@ demo=gr.Interface(
|
|
31 |
description="1)Select language 2)Click on 'record from microphone' and talk 3)Click on 'stop recording' 4)Click on submit 5)Before starting again, click on 'clear'",
|
32 |
|
33 |
inputs=[
|
34 |
-
gr.Dropdown(["Spanish","Catalan","English"],value="Spanish"),
|
35 |
#gr.Audio(source="microphone", type="filepath", streaming=True),
|
36 |
gr.inputs.Audio(source="microphone", type="filepath"),
|
37 |
"state"#,"language"
|
|
|
5 |
p = pipeline("automatic-speech-recognition",model="jonatasgrosman/wav2vec2-large-xlsr-53-spanish")
|
6 |
pc = pipeline("automatic-speech-recognition",model="softcatala/wav2vec2-large-xlsr-catala")
|
7 |
pe = pipeline("automatic-speech-recognition",model="jonatasgrosman/wav2vec2-large-xlsr-53-english")
|
8 |
+
pj = pipeline("automatic-speech-recognition",model="jonatasgrosman/wav2vec2-large-xlsr-53-japanese")
|
9 |
+
pf = pipeline("automatic-speech-recognition",model="jonatasgrosman/wav2vec2-large-xlsr-53-french")
|
10 |
|
11 |
|
12 |
|
|
|
22 |
if language=="English":
|
23 |
state=""
|
24 |
text = pe(audio)["text"]
|
25 |
+
if language=="French":
|
26 |
+
state=""
|
27 |
+
text = pf(audio)["text"]
|
28 |
+
if language=="Japanese":
|
29 |
+
state=""
|
30 |
+
text = pj(audio)["text"]
|
31 |
state += text + " "
|
32 |
#text2="Esto es loq ue te he entendido"
|
33 |
return state, state
|
|
|
39 |
description="1)Select language 2)Click on 'record from microphone' and talk 3)Click on 'stop recording' 4)Click on submit 5)Before starting again, click on 'clear'",
|
40 |
|
41 |
inputs=[
|
42 |
+
gr.Dropdown(["Spanish","Catalan","English", "French", "Japanese"],value="Spanish"),
|
43 |
#gr.Audio(source="microphone", type="filepath", streaming=True),
|
44 |
gr.inputs.Audio(source="microphone", type="filepath"),
|
45 |
"state"#,"language"
|