Tlanextli commited on
Commit
6b9c021
0 Parent(s):

Duplicate from Tlanextli/Speech2Text_Ge

Browse files
Files changed (8) hide show
  1. .gitattributes +35 -0
  2. README.md +14 -0
  3. ReverseAudio_app.py +19 -0
  4. app.py +34 -0
  5. app_en.py +21 -0
  6. app_ge.py +22 -0
  7. mlk.flac +0 -0
  8. requirements.txt +5 -0
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Stimme2Text
3
+ emoji: 🐢
4
+ colorFrom: gray
5
+ colorTo: blue
6
+ sdk: gradio
7
+ sdk_version: 3.42.0
8
+ app_file: app.py
9
+ pinned: false
10
+ license: afl-3.0
11
+ duplicated_from: Tlanextli/Speech2Text_Ge
12
+ ---
13
+
14
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
ReverseAudio_app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ import numpy as np
4
+
5
+ import gradio as gr
6
+
7
+
8
+ def reverse_audio(audio):
9
+ sr, data = audio
10
+ return (sr, np.flipud(data))
11
+
12
+
13
+ demo = gr.Interface(fn=reverse_audio,
14
+ inputs="microphone",
15
+ outputs="audio"
16
+ )
17
+
18
+ if __name__ == "__main__":
19
+ demo.launch()
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import gradio as gr
3
+ from transformers import pipeline
4
+
5
+ title = "Transcribe speech in German"
6
+
7
+ pipeline = pipeline(task="automatic-speech-recognition", model="jonatasgrosman/wav2vec2-large-xlsr-53-german")
8
+ #pipeline = pipeline(task="automatic-speech-recognition", model="openai/whisper-large")
9
+
10
+ def transcribeFile(audio_path : str) -> str:
11
+ transcription = pipeline(audio_path)
12
+ return transcription["text"]
13
+
14
+
15
+ app1 = gr.Interface(
16
+ fn=transcribeFile,
17
+ inputs=gr.inputs.Audio(label="Upload audio file", type="filepath"),
18
+ outputs="text",
19
+ title=title
20
+ )
21
+
22
+
23
+ app2 = gr.Interface(
24
+ fn=transcribeFile,
25
+ inputs=gr.Audio(source="microphone", type="filepath"),
26
+ outputs="text",
27
+ title=title
28
+ )
29
+
30
+
31
+ demo = gr.TabbedInterface([app1, app2], ["Audio File", "Microphone"])
32
+
33
+ if __name__ == "__main__":
34
+ demo.launch()
app_en.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import gradio as gr
3
+ from transformers import pipeline
4
+
5
+ pipeline = pipeline(task="automatic-speech-recognition", model="openai/whisper-large")
6
+
7
+ def transcribe(audio_path : str) -> str:
8
+ transcription = pipeline(audio_path)
9
+ return transcription
10
+
11
+
12
+ demo = gr.Interface(
13
+ fn=transcribe,
14
+ #inputs="microphone",
15
+ inputs=gr.inputs.Audio(label="Upload audio file", type="filepath"),
16
+ outputs="text"
17
+ )
18
+
19
+
20
+ if __name__ == "__main__":
21
+ demo.launch()
app_ge.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import gradio as gr
3
+ from transformers import pipeline
4
+
5
+ pipeline = pipeline(task="automatic-speech-recognition", model="jonatasgrosman/wav2vec2-large-xlsr-53-german")
6
+ #pipeline = pipeline(task="automatic-speech-recognition", model="openai/whisper-large")
7
+
8
+ def transcribe(audio_path : str) -> str:
9
+ transcription = pipeline(audio_path)
10
+ return transcription["text"]
11
+
12
+
13
+ demo = gr.Interface(
14
+ fn=transcribe,
15
+ #inputs="microphone",
16
+ inputs=gr.inputs.Audio(label="Upload audio file", type="filepath"),
17
+ outputs="text"
18
+ )
19
+
20
+
21
+ if __name__ == "__main__":
22
+ demo.launch()
mlk.flac ADDED
Binary file (383 kB). View file
 
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ transformers
2
+ torch
3
+ kenlm
4
+ pyctcdecode
5
+ numpy