Spaces:
Running
Running
Download app.py from aheedsajid/Edge-TT: direct link, hf CLI and curl.
- Browser
- Download file 586 Bytes
-
https://huggingface.co/spaces/aheedsajid/Edge-TT/resolve/b23d86c9196b30405c794bb817270c96dffeb80d/app.py
- Command line
-
hf download hf://spaces/aheedsajid/Edge-TT@b23d86c9196b30405c794bb817270c96dffeb80d/app.py
-
curl -L -o app.py https://huggingface.co/spaces/aheedsajid/Edge-TT/resolve/b23d86c9196b30405c794bb817270c96dffeb80d/app.py
586 Bytes
| import gradio as gr | |
| def text_to_speech(text, voice): | |
| import subprocess | |
| import audiosegment | |
| from IPython.display import Audio, display | |
| command = ['edge-tts', '--voice', voice, '--text', text, | |
| '--write-media', 'edge.mp3', '--write-subtitles', 'edge.vtt'] | |
| result = subprocess.run(command, stdout=subprocess.PIPE, text=True) | |
| print(result.stdout) | |
| try: | |
| display(Audio("edge.mp3", autoplay=True)) | |
| except Exception as e: | |
| print("Error:", str(e)) | |
| gr.Interface(fn=text_to_speech, inputs=["text", "text"], outputs="audio").launch() |