Spaces:
Runtime error
Runtime error
File size: 1,354 Bytes
e41ca58 ee5f3cc e41ca58 ee5f3cc e41ca58 ee5f3cc e41ca58 ee5f3cc e41ca58 41effa6 e41ca58 ee5f3cc e41ca58 41effa6 e41ca58 ee5f3cc e41ca58 ee5f3cc e41ca58 ee5f3cc e41ca58 ee5f3cc 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 |
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="filepath"),
device
],
outputs="text",
title="Speech-to-text"
)
goai_tts = gr.Interface(
fn=goai_tts.goai_tts,
inputs=[
gr.Text(label="Input text"),
device
],
outputs=[
gr.Audio(label="Generated Audio", type="numpy")
],
title="Text-to-speech"
)
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="Translation Demo",
)
with demo:
gr.TabbedInterface(
[goai_traduction, goai_tts, goai_stt],
["Translation", "Text-to-speech", "Speech-to-text"],
)
demo.launch() |