Spaces:
Sleeping
Sleeping
import gradio as gr | |
import requests | |
import os | |
def text_to_speech(text): | |
test = os.environ.get("test") | |
endpoint = f"https://api.voicerss.org/?key={test}&src={text}&hl=en-us&v=Mike" | |
response = requests.get(endpoint) | |
with open("output.mp3", "wb") as f: | |
f.write(response.content) | |
return "output.mp3" | |
gr.Interface(text_to_speech, inputs="text", outputs="audio").launch() | |