Update app.py
Browse files
app.py
CHANGED
@@ -41,14 +41,13 @@ def convert_tts_sync(*args):
|
|
41 |
asyncio.set_event_loop(loop)
|
42 |
return loop.run_until_complete(convert_tts(*args))
|
43 |
|
44 |
-
def batch_convert_tts(
|
45 |
results = []
|
46 |
|
47 |
try:
|
48 |
-
|
49 |
-
batch_data = json.load(file)
|
50 |
except Exception as e:
|
51 |
-
return {"error": f"Failed to
|
52 |
|
53 |
with ThreadPoolExecutor() as executor:
|
54 |
future_to_entry = {
|
@@ -99,7 +98,7 @@ iface = gr.Interface(
|
|
99 |
|
100 |
batch_iface = gr.Interface(
|
101 |
fn=batch_convert_tts,
|
102 |
-
inputs=gr.
|
103 |
outputs=gr.JSON(label="Batch Results"),
|
104 |
title="Batch Text-to-Speech Conversion",
|
105 |
allow_flagging="never"
|
@@ -112,3 +111,4 @@ app = gr.TabbedInterface(
|
|
112 |
|
113 |
app.launch()
|
114 |
|
|
|
|
41 |
asyncio.set_event_loop(loop)
|
42 |
return loop.run_until_complete(convert_tts(*args))
|
43 |
|
44 |
+
def batch_convert_tts(json_input):
|
45 |
results = []
|
46 |
|
47 |
try:
|
48 |
+
batch_data = json.loads(json_input)
|
|
|
49 |
except Exception as e:
|
50 |
+
return {"error": f"Failed to parse JSON input: {str(e)}"}
|
51 |
|
52 |
with ThreadPoolExecutor() as executor:
|
53 |
future_to_entry = {
|
|
|
98 |
|
99 |
batch_iface = gr.Interface(
|
100 |
fn=batch_convert_tts,
|
101 |
+
inputs=gr.Textbox(label="JSON Input", lines=20, placeholder='Paste your JSON input here'),
|
102 |
outputs=gr.JSON(label="Batch Results"),
|
103 |
title="Batch Text-to-Speech Conversion",
|
104 |
allow_flagging="never"
|
|
|
111 |
|
112 |
app.launch()
|
113 |
|
114 |
+
|