multiple files
Browse files
app.py
CHANGED
@@ -4,12 +4,10 @@ from asr import transcribe, ASR_LANGUAGES, model
|
|
4 |
from tts import synthesize, TTS_EXAMPLES, TTS_LANGUAGES
|
5 |
from lid import identify, LID_EXAMPLES
|
6 |
|
7 |
-
|
8 |
-
|
9 |
mms_transcribe = gr.Interface(
|
10 |
-
fn=lambda
|
11 |
inputs=[
|
12 |
-
gr.
|
13 |
gr.Dropdown(
|
14 |
[f"{k} ({v})" for k, v in ASR_LANGUAGES.items()],
|
15 |
label="Language",
|
@@ -17,33 +15,12 @@ mms_transcribe = gr.Interface(
|
|
17 |
),
|
18 |
gr.Textbox(label="Optional: Provide your own transcription"),
|
19 |
],
|
20 |
-
outputs="text",
|
21 |
title="Speech-to-text",
|
22 |
-
description=("Transcribe audio from a microphone or input
|
23 |
allow_flagging="never",
|
24 |
)
|
25 |
|
26 |
-
#mms_synthesize = gr.Interface(
|
27 |
-
#fn=synthesize,
|
28 |
-
#inputs=[
|
29 |
-
#gr.Text(label="Input text"),
|
30 |
-
#gr.Dropdown(
|
31 |
-
#[f"{k} ({v})" for k, v in TTS_LANGUAGES.items()],
|
32 |
-
#label="Language",
|
33 |
-
#value="eng English",
|
34 |
-
#),
|
35 |
-
#gr.Slider(minimum=0.1, maximum=4.0, value=1.0, step=0.1, label="Speed"),
|
36 |
-
#],
|
37 |
-
#outputs=[
|
38 |
-
# gr.Audio(label="Generated Audio", type="numpy"),
|
39 |
-
#gr.Text(label="Filtered text after removing OOVs"),
|
40 |
-
#],
|
41 |
-
#examples=TTS_EXAMPLES,
|
42 |
-
#title="Text-to-speech",
|
43 |
-
#description=("Generate audio in your desired language from input text."),
|
44 |
-
#allow_flagging="never",
|
45 |
-
#)
|
46 |
-
|
47 |
mms_identify = gr.Interface(
|
48 |
fn=identify,
|
49 |
inputs=[
|
|
|
4 |
from tts import synthesize, TTS_EXAMPLES, TTS_LANGUAGES
|
5 |
from lid import identify, LID_EXAMPLES
|
6 |
|
|
|
|
|
7 |
mms_transcribe = gr.Interface(
|
8 |
+
fn=lambda audio_files, lang, transcription: [transcribe(model, audio, lang, transcription) for audio in audio_files],
|
9 |
inputs=[
|
10 |
+
gr.inputs.File(type="audio", multiple=True), # Allow multiple audio files
|
11 |
gr.Dropdown(
|
12 |
[f"{k} ({v})" for k, v in ASR_LANGUAGES.items()],
|
13 |
label="Language",
|
|
|
15 |
),
|
16 |
gr.Textbox(label="Optional: Provide your own transcription"),
|
17 |
],
|
18 |
+
outputs="text", # Return a list of transcriptions
|
19 |
title="Speech-to-text",
|
20 |
+
description=("Transcribe multiple audio files from a microphone or input files in your desired language."),
|
21 |
allow_flagging="never",
|
22 |
)
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
mms_identify = gr.Interface(
|
25 |
fn=identify,
|
26 |
inputs=[
|