Update app.py
Browse files
app.py
CHANGED
@@ -1,35 +1,35 @@
|
|
1 |
import gradio as gr
|
2 |
-
import
|
3 |
-
from
|
4 |
-
import
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
logits = model(inputs.input_values, attention_mask=inputs.attention_mask).logits
|
19 |
-
|
20 |
-
# Get predicted ids
|
21 |
-
predicted_ids = torch.argmax(logits, dim=-1)
|
22 |
-
|
23 |
-
# Decode the ids to text
|
24 |
-
transcription = processor.batch_decode(predicted_ids)
|
25 |
-
return transcription[0]
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
33 |
|
34 |
if __name__ == "__main__":
|
35 |
-
|
|
|
1 |
import gradio as gr
|
2 |
+
from asr import transcribe
|
3 |
+
from tts import synthesize_speech
|
4 |
+
from lid import identify_language
|
5 |
|
6 |
+
def main():
|
7 |
+
asr_interface = gr.Interface(
|
8 |
+
fn=transcribe,
|
9 |
+
inputs=gr.Audio(type="filepath"),
|
10 |
+
outputs="text",
|
11 |
+
title="Faroese ASR Demo",
|
12 |
+
description="Automatic Speech Recognition for Faroese"
|
13 |
+
)
|
14 |
|
15 |
+
tts_interface = gr.Interface(
|
16 |
+
fn=synthesize_speech,
|
17 |
+
inputs="text",
|
18 |
+
outputs="audio",
|
19 |
+
title="Faroese TTS Demo",
|
20 |
+
description="Text-to-Speech Synthesis for Faroese"
|
21 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
+
lid_interface = gr.Interface(
|
24 |
+
fn=identify_language,
|
25 |
+
inputs=gr.Audio(type="filepath"),
|
26 |
+
outputs="label",
|
27 |
+
title="Language Identification",
|
28 |
+
description="Identify the language of the spoken input"
|
29 |
+
)
|
30 |
+
|
31 |
+
demo = gr.TabbedInterface([asr_interface, tts_interface, lid_interface], ["ASR", "TTS", "LID"])
|
32 |
+
demo.launch()
|
33 |
|
34 |
if __name__ == "__main__":
|
35 |
+
main()
|