Spaces:
Runtime error
Runtime error
Commit
•
510bcda
0
Parent(s):
Duplicate from JPLTedCas/TedCasSpeechRecognition
Browse files- .gitattributes +31 -0
- README.md +14 -0
- app.py +54 -0
- packages.txt +1 -0
- requirements.txt +4 -0
.gitattributes
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
23 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: TedCasSpeechRecognition
|
3 |
+
emoji: 💩
|
4 |
+
colorFrom: green
|
5 |
+
colorTo: gray
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 3.3.1
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
license: apache-2.0
|
11 |
+
duplicated_from: JPLTedCas/TedCasSpeechRecognition
|
12 |
+
---
|
13 |
+
|
14 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
+
import time
|
4 |
+
|
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 |
+
|
13 |
+
|
14 |
+
def transcribe(language,audio, state=""):#language="Spanish",
|
15 |
+
time.sleep(1)
|
16 |
+
if language=="Spanish":
|
17 |
+
state=""
|
18 |
+
text = p(audio)["text"]
|
19 |
+
if language=="Catalan":
|
20 |
+
state=""
|
21 |
+
text = pc(audio)["text"]
|
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
|
34 |
+
|
35 |
+
demo=gr.Interface(
|
36 |
+
fn=transcribe,
|
37 |
+
|
38 |
+
title="TEDCAS Offline Speech recognition",
|
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"
|
46 |
+
],
|
47 |
+
outputs=[
|
48 |
+
"textbox",
|
49 |
+
"state"
|
50 |
+
],
|
51 |
+
#live=True).launch()
|
52 |
+
)
|
53 |
+
demo.launch()
|
54 |
+
#demo.launch(auth=("TedCas", "Kike1234"))
|
packages.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
ffmpeg
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
torch
|
3 |
+
pyctcdecode
|
4 |
+
pypi-kenlm
|