Spaces:
Running
Running
Commit
·
5316822
1
Parent(s):
a5e687b
Added list of available languages
Browse files- .gitignore +1 -0
- app.py +18 -3
- requirements.txt +1 -1
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
.vscode
|
app.py
CHANGED
@@ -4,11 +4,21 @@ import gradio as gr
|
|
4 |
|
5 |
|
6 |
|
7 |
-
|
|
|
8 |
|
9 |
|
|
|
|
|
|
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
text = model.stt_model.transcribe([audio])[0]
|
13 |
return text
|
14 |
|
@@ -18,7 +28,12 @@ def transcribe(audio):
|
|
18 |
gr.Interface(
|
19 |
fn=transcribe,
|
20 |
inputs=[
|
21 |
-
gr.Audio(source="microphone", type="filepath")
|
|
|
|
|
|
|
|
|
|
|
22 |
],
|
23 |
outputs=[
|
24 |
"textbox"
|
|
|
4 |
|
5 |
|
6 |
|
7 |
+
LANGUAGES = list(Model.langs.keys())
|
8 |
+
default_lang = "en"
|
9 |
|
10 |
|
11 |
+
engines = {
|
12 |
+
default_lang: Model(default_lang)
|
13 |
+
}
|
14 |
|
15 |
+
|
16 |
+
|
17 |
+
def transcribe(audio, language: str):
|
18 |
+
if language not in engines:
|
19 |
+
engines[language] = Model(language)
|
20 |
+
|
21 |
+
model = engines[language]
|
22 |
text = model.stt_model.transcribe([audio])[0]
|
23 |
return text
|
24 |
|
|
|
28 |
gr.Interface(
|
29 |
fn=transcribe,
|
30 |
inputs=[
|
31 |
+
gr.Audio(source="microphone", type="filepath"),
|
32 |
+
gr.Radio(
|
33 |
+
label="Language",
|
34 |
+
choices=LANGUAGES,
|
35 |
+
value=default_lang
|
36 |
+
)
|
37 |
],
|
38 |
outputs=[
|
39 |
"textbox"
|
requirements.txt
CHANGED
@@ -1 +1 @@
|
|
1 |
-
streaming-stt-nemo
|
|
|
1 |
+
streaming-stt-nemo==0.0.4a0
|