File size: 596 Bytes
e695abb f04e991 303db20 05c7043 e695abb 303db20 05c7043 e695abb 715093b e695abb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import gradio as gr
import urllib.request
import requests
# from pydub import AudioSegment
def function1(prompt):
response = requests.post("https://matthijs-speecht5-tts-demo.hf.space/run/predict", json={
"data": [
prompt,
"KSP (male)",
]
}).json()
data = response["data"][0]["name"]
data = "https://matthijs-speecht5-tts-demo.hf.space/file="+data
speech = urllib.request.urlretrieve(data, "speech.mp3")
return speech
iface = gr.Interface(fn=function1, inputs="text", outputs=[gr.Audio(label="Audio",type="numpy")])
iface.launch() |