Spaces:
Runtime error
Runtime error
VoiceCloning-be
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
import edge_tts
|
3 |
import asyncio
|
@@ -10,6 +11,7 @@ async def get_voices():
|
|
10 |
return {f"{v['ShortName']} - {v['Locale']} ({v['Gender']})": v['ShortName'] for v in voices}
|
11 |
|
12 |
# Text-to-speech function
|
|
|
13 |
async def text_to_speech(text, voice, rate, pitch):
|
14 |
if not text.strip():
|
15 |
return None, gr.Warning("Please enter text to convert.")
|
@@ -26,6 +28,7 @@ async def text_to_speech(text, voice, rate, pitch):
|
|
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
|
@@ -33,6 +36,7 @@ def tts_interface(text, voice, rate, pitch):
|
|
33 |
# Create Gradio application
|
34 |
import gradio as gr
|
35 |
|
|
|
36 |
async def create_demo():
|
37 |
voices = await get_voices()
|
38 |
|
|
|
1 |
+
import spaces
|
2 |
import gradio as gr
|
3 |
import edge_tts
|
4 |
import asyncio
|
|
|
11 |
return {f"{v['ShortName']} - {v['Locale']} ({v['Gender']})": v['ShortName'] for v in voices}
|
12 |
|
13 |
# Text-to-speech function
|
14 |
+
@spaces.GPU
|
15 |
async def text_to_speech(text, voice, rate, pitch):
|
16 |
if not text.strip():
|
17 |
return None, gr.Warning("Please enter text to convert.")
|
|
|
28 |
return tmp_path, None
|
29 |
|
30 |
# Gradio interface function
|
31 |
+
@spaces.GPU
|
32 |
def tts_interface(text, voice, rate, pitch):
|
33 |
audio, warning = asyncio.run(text_to_speech(text, voice, rate, pitch))
|
34 |
return audio, warning
|
|
|
36 |
# Create Gradio application
|
37 |
import gradio as gr
|
38 |
|
39 |
+
@spaces.GPU
|
40 |
async def create_demo():
|
41 |
voices = await get_voices()
|
42 |
|