File size: 1,921 Bytes
e41ca58
 
 
ee5f3cc
e41ca58
 
ee5f3cc
e41ca58
ee5f3cc
 
e41ca58
 
 
ee5f3cc
 
e41ca58
b708820
e41ca58
 
8ae0a52
 
 
 
 
 
 
 
e41ca58
 
ee5f3cc
 
e41ca58
6ffc425
e41ca58
 
 
 
8ae0a52
 
e41ca58
 
ee5f3cc
 
e41ca58
 
 
 
 
 
ee5f3cc
8ae0a52
 
e41ca58
 
ee5f3cc
e41ca58
 
ee5f3cc
8ae0a52
e41ca58
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import torch
import scipy
import gradio as gr
from transformers import set_seed
from datasets import load_dataset, Audio

import  goai_stt, goai_tts, goai_traduction

#language_list = ['mos', 'fra', 'eng']
device = 0 if torch.cuda.is_available() else "cpu"

demo = gr.Blocks()

goai_stt = gr.Interface(
    fn = goai_stt.goai_stt,
    inputs=[
        gr.Audio(sources=["microphone", "upload"], type="numpy")
    ],
    outputs="text",
    examples=[["./example1.wav"], 
              ["./example2.wav"],
              ["./example3.wav"],
              ["./example4.wav"],
              ["./example5.wav"]],
    
    title="Transcription Mooré: audio vers texte",
    description="Démo de transcription de la parole vers le texte en langage Mooré. Enregistrez l'audio à partir de votre micro ou uploadez-le depuis votre appareil!",
)

goai_tts = gr.Interface(
    fn=goai_tts.goai_tts,
    inputs=[
        gr.Text(label="Input text")
    ],
    outputs=[
        gr.Audio(label="Generated Audio", type="numpy")
    ],
    title="Synthèse vocale Mooré: texte vers audio",
    description="Démo de synthèse vocale d'un texte en langage Mooré!",
)

goai_traduction = gr.Interface(
    fn=goai_traduction.goai_traduction,
    inputs=[
        gr.Textbox(label="Text", placeholder="Yaa sõama"),
        gr.Dropdown(label="Source Language", choices=["eng_Latn", "fra_Latn", "mos_Latn"]),
        gr.Dropdown(label="Target Language", choices=["eng_Latn", "fra_Latn", "mos_Latn"])
    ],
    outputs=["text"],
    examples=[["Yʋʋm a wãn la b kẽesd biig lekolle?", "mos_Latn", "fra_Latn"]],
    title="Traduction du Mooré: texte vers texte",
    description="Démo de traduction d'un texte en langage Mooré à partir de l'anglais ou du francais!",
)


with demo:
    gr.TabbedInterface(
        [goai_traduction, goai_tts, goai_stt],
        ["Traduction", "Text-2-speech", "Speech-2-text"],
    )

demo.launch()