File size: 877 Bytes
1c7cbff 5966f2d 1c7cbff 5966f2d 1c7cbff 5966f2d 1c7cbff 5966f2d 7dca967 1c7cbff 775119b 1c7cbff 138a0f7 1c7cbff |
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 |
import os
import spaces
from huggingface_hub import login
from goai_helpers.goai_traduction import goai_traduction
from goai_helpers.goai_stt2 import transcribe
# authentification
auth_token = os.getenv('HF_SPACE_TOKEN')
login(token=auth_token)
# gradio interface translation and text to speech function
@spaces.GPU(duration=120)
def goai_stt_ttt(
inputs,
model,
language,
batch_size,
chunk_length_s,
stride_length_s
):
# 1. STT: Speech To Text
mos_text = transcribe(
inputs,
model,
language,
batch_size,
chunk_length_s,
stride_length_s
)[0]
yield mos_text, None
# 2. TTT: Translation mos ==> fr
fr_text = goai_traduction(
mos_text,
src_lang="mos_Latn",
tgt_lang="fra_Latn"
)
yield mos_text, fr_text |