Nuno-Tome's picture
project kick off
0b78698
raw
history blame
978 Bytes
import gradio as gr
from gradio_client import Client
DEBUG_MODE = True
'''
Function to get the speech from the text
@params: text: str, voice: audio
@returns: result: speech audio
'''
def get_speech(text, voice):
'''
For now we are using external space to get the result.
In future we will use our own model to get be more independent
'''
client = Client("https://collabora-whisperspeech.hf.space/")
result = client.predict(
# str in 'Enter multilingual text๐Ÿ“๐Ÿ’ฌ' Textbox component
text,
# filepath in 'Upload or Record Speaker Audio (optional)๐ŸŒฌ๏ธ๐Ÿ’ฌ' Audio component
voice,
"", # str in 'alternatively, you can paste in an audio file URL:' Textbox component
14, # float (numeric value between 10 and 15) in 'Tempo (in characters per second)' Slider component
api_name="/whisper_speech_demo"
)
if DEBUG_MODE:
print(result)
return result