Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,8 +5,8 @@ import tempfile
|
|
5 |
import os
|
6 |
|
7 |
# Get all available voices
|
8 |
-
def get_voices():
|
9 |
-
voices =
|
10 |
return {f"{v['ShortName']} - {v['Locale']} ({v['Gender']})": v['ShortName'] for v in voices}
|
11 |
|
12 |
# Text-to-speech function
|
@@ -25,17 +25,34 @@ async def text_to_speech(text, voice, rate, pitch):
|
|
25 |
await communicate.save(tmp_path)
|
26 |
return tmp_path, None
|
27 |
|
28 |
-
#
|
29 |
def tts_interface(text, voice, rate, pitch):
|
30 |
audio, warning = asyncio.run(text_to_speech(text, voice, rate, pitch))
|
31 |
return audio, warning
|
32 |
|
33 |
# Create Gradio application
|
34 |
-
|
35 |
-
voices = get_voices()
|
36 |
-
|
37 |
-
description = "Convert text to speech using Microsoft Edge TTS. Adjust speech rate and pitch: 0 is default, positive values increase, negative values decrease."
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
demo = gr.Interface(
|
40 |
fn=tts_interface,
|
41 |
inputs=[
|
@@ -50,7 +67,7 @@ def create_demo():
|
|
50 |
],
|
51 |
title="Edge TTS Text-to-Speech",
|
52 |
description=description,
|
53 |
-
article="Experience the power of Edge TTS for text-to-speech conversion!",
|
54 |
analytics_enabled=False,
|
55 |
allow_flagging="manual"
|
56 |
)
|
@@ -58,5 +75,5 @@ def create_demo():
|
|
58 |
|
59 |
# Run the application
|
60 |
if __name__ == "__main__":
|
61 |
-
demo = create_demo()
|
62 |
-
demo.launch()
|
|
|
5 |
import os
|
6 |
|
7 |
# Get all available voices
|
8 |
+
async def get_voices():
|
9 |
+
voices = await edge_tts.list_voices()
|
10 |
return {f"{v['ShortName']} - {v['Locale']} ({v['Gender']})": v['ShortName'] for v in voices}
|
11 |
|
12 |
# Text-to-speech function
|
|
|
25 |
await communicate.save(tmp_path)
|
26 |
return tmp_path, None
|
27 |
|
28 |
+
# Gradio interface function
|
29 |
def tts_interface(text, voice, rate, pitch):
|
30 |
audio, warning = asyncio.run(text_to_speech(text, voice, rate, pitch))
|
31 |
return audio, warning
|
32 |
|
33 |
# Create Gradio application
|
34 |
+
import gradio as gr
|
|
|
|
|
|
|
35 |
|
36 |
+
async def create_demo():
|
37 |
+
voices = await get_voices()
|
38 |
+
|
39 |
+
description = """
|
40 |
+
Convert text to speech using Microsoft Edge TTS. Adjust speech rate and pitch: 0 is default, positive values increase, negative values decrease.
|
41 |
+
|
42 |
+
🎥 **Exciting News: Introducing our Text-to-Video Converter!** 🎥
|
43 |
+
|
44 |
+
Take your content creation to the next level with our cutting-edge Text-to-Video Converter!
|
45 |
+
Transform your words into stunning, professional-quality videos in just a few clicks.
|
46 |
+
|
47 |
+
✨ Features:
|
48 |
+
• Convert text to engaging videos with customizable visuals
|
49 |
+
• Choose from 40+ languages and 300+ voices
|
50 |
+
• Perfect for creating audiobooks, storytelling, and language learning materials
|
51 |
+
• Ideal for educators, content creators, and language enthusiasts
|
52 |
+
|
53 |
+
Ready to revolutionize your content? [Click here to try our Text-to-Video Converter now!](https://text2video.wingetgui.com/)
|
54 |
+
"""
|
55 |
+
|
56 |
demo = gr.Interface(
|
57 |
fn=tts_interface,
|
58 |
inputs=[
|
|
|
67 |
],
|
68 |
title="Edge TTS Text-to-Speech",
|
69 |
description=description,
|
70 |
+
article="Experience the power of Edge TTS for text-to-speech conversion, and explore our advanced Text-to-Video Converter for even more creative possibilities!",
|
71 |
analytics_enabled=False,
|
72 |
allow_flagging="manual"
|
73 |
)
|
|
|
75 |
|
76 |
# Run the application
|
77 |
if __name__ == "__main__":
|
78 |
+
demo = asyncio.run(create_demo())
|
79 |
+
demo.launch()
|