Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ import numpy as np
|
|
4 |
from scipy.io import wavfile
|
5 |
from voice_processing import parallel_tts, get_model_names, voice_mapping
|
6 |
from io import BytesIO
|
7 |
-
import asyncio
|
8 |
|
9 |
# Define an asynchronous function for the Gradio interface
|
10 |
async def convert_tts(model_name, tts_text, selected_voice, slang_rate, use_uploaded_voice, voice_upload):
|
@@ -23,8 +23,7 @@ async def convert_tts(model_name, tts_text, selected_voice, slang_rate, use_uplo
|
|
23 |
)
|
24 |
|
25 |
# Asynchronous call to your tts processing function using parallel processing
|
26 |
-
|
27 |
-
result = await loop.run_in_executor(None, parallel_tts, [task])
|
28 |
info, _, (tgt_sr, audio_output) = result[0]
|
29 |
|
30 |
# Process audio output to bytes
|
@@ -59,13 +58,10 @@ iface = gr.Interface(
|
|
59 |
],
|
60 |
outputs=[
|
61 |
gr.JSON(label="Info"),
|
62 |
-
gr.
|
63 |
],
|
64 |
-
title="Text-to-Speech Conversion"
|
65 |
-
concurrency_limit=10 # Limit concurrent requests to 10
|
66 |
)
|
67 |
|
68 |
# Launch the interface
|
69 |
-
|
70 |
-
iface.queue()
|
71 |
-
iface.launch(debug=True, show_error=True)
|
|
|
4 |
from scipy.io import wavfile
|
5 |
from voice_processing import parallel_tts, get_model_names, voice_mapping
|
6 |
from io import BytesIO
|
7 |
+
import asyncio # Import asyncio
|
8 |
|
9 |
# Define an asynchronous function for the Gradio interface
|
10 |
async def convert_tts(model_name, tts_text, selected_voice, slang_rate, use_uploaded_voice, voice_upload):
|
|
|
23 |
)
|
24 |
|
25 |
# Asynchronous call to your tts processing function using parallel processing
|
26 |
+
result = await asyncio.get_event_loop().run_in_executor(None, parallel_tts, [task])
|
|
|
27 |
info, _, (tgt_sr, audio_output) = result[0]
|
28 |
|
29 |
# Process audio output to bytes
|
|
|
58 |
],
|
59 |
outputs=[
|
60 |
gr.JSON(label="Info"),
|
61 |
+
gr.Textbox(label="Audio URI")
|
62 |
],
|
63 |
+
title="Text-to-Speech Conversion"
|
|
|
64 |
)
|
65 |
|
66 |
# Launch the interface
|
67 |
+
iface.launch(debug=True) # Set share=True to create a public link
|
|
|
|