Prgckwb commited on
Commit
ca99c4a
1 Parent(s): 7fdb5ea
Files changed (1) hide show
  1. app.py +5 -12
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import os
2
 
3
  import gradio as gr
@@ -15,19 +16,11 @@ speaker_ids = model.hps.data.spk2id
15
 
16
 
17
  def inference(
18
- text: str, speed: float, speaker: str, progress=gr.Progress(track_tqdm=True)
19
  ):
20
- # Ensure text is a string
21
- if not isinstance(text, str):
22
- raise gr.Error(f"Expected string or bytes, got {type(text)}: {text}")
23
-
24
- output_path = "audio.wav"
25
-
26
- # Debugging: Print the input text and other parameters
27
- print(f"Input text: {text}, Speed: {speed}, Speaker: {speaker}")
28
-
29
- model.tts_to_file(text, speaker_ids[speaker], output_path, speed=speed)
30
- return output_path
31
 
32
 
33
  if __name__ == "__main__":
 
1
+ import io
2
  import os
3
 
4
  import gradio as gr
 
16
 
17
 
18
  def inference(
19
+ text: str, speed: float, speaker: str, progress=gr.Progress(track_tqdm=True)
20
  ):
21
+ bio = io.BytesIO()
22
+ model.tts_to_file(text, speaker_ids[speaker], bio, speed=speed)
23
+ return bio
 
 
 
 
 
 
 
 
24
 
25
 
26
  if __name__ == "__main__":