Vijish commited on
Commit
e7a7e70
·
verified ·
1 Parent(s): 9325cfe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
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(json_file):
45
  results = []
46
 
47
  try:
48
- with open(json_file.name, 'r') as file:
49
- batch_data = json.load(file)
50
  except Exception as e:
51
- return {"error": f"Failed to read JSON file: {str(e)}"}
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.File(label="JSON File"),
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
+