MAZALA2024 commited on
Commit
b36f420
·
verified ·
1 Parent(s): 25d7a78

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -15,10 +15,15 @@ def convert_tts(model_name, tts_text, selected_voice, slang_rate, use_uploaded_v
15
  voice_upload_file = voice_upload.read()
16
 
17
  # Call the tts processing function
18
- info, _, (tgt_sr, audio_output) = tts(
19
  model_name, tts_text, edge_tts_voice, slang_rate, use_uploaded_voice, voice_upload_file
20
  )
21
 
 
 
 
 
 
22
  # Process audio output to bytes
23
  audio_bytes = None
24
  if isinstance(audio_output, np.ndarray):
@@ -54,9 +59,8 @@ iface = gr.Interface(
54
  gr.Textbox(label="Audio URI")
55
  ],
56
  title="Text-to-Speech Conversion",
57
- # Set concurrency_limit directly in Interface constructor
58
- concurrency_count=10 # Adjust based on your server capacity
59
  )
60
 
61
- # Launch the interface with max_threads
62
- iface.launch(debug=True, max_threads=10) # Adjust max_threads if needed
 
15
  voice_upload_file = voice_upload.read()
16
 
17
  # Call the tts processing function
18
+ result = tts(
19
  model_name, tts_text, edge_tts_voice, slang_rate, use_uploaded_voice, voice_upload_file
20
  )
21
 
22
+ if isinstance(result, dict) and "error" in result:
23
+ return result, None
24
+
25
+ info, _, (tgt_sr, audio_output) = result
26
+
27
  # Process audio output to bytes
28
  audio_bytes = None
29
  if isinstance(audio_output, np.ndarray):
 
59
  gr.Textbox(label="Audio URI")
60
  ],
61
  title="Text-to-Speech Conversion",
62
+ concurrency_limit=10 # Set the concurrency limit here
 
63
  )
64
 
65
+ # Launch the interface
66
+ iface.launch(debug=True)