osanseviero HF staff commited on
Commit
dd29aa4
1 Parent(s): 42ed2a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -11,6 +11,7 @@ subprocess.check_call([sys.executable, "-m", "pip", "install", "entmax"])
11
  from tortoise_tts.api import TextToSpeech
12
  from tortoise_tts.utils.audio import load_audio, get_voices
13
  import torch
 
14
  import gradio as gr
15
 
16
  device = "cuda" if torch.cuda.is_available() else "cpu"
@@ -47,7 +48,9 @@ def inference(text, voice):
47
  conds.append(c)
48
  print(text, conds, preset)
49
  gen = tts.tts_with_preset(text, conds, preset)
50
- return gen
 
 
51
 
52
  text = "Joining two modalities results in a surprising increase in generalization! What would happen if we combined them all?"
53
  iface = gr.Interface(
@@ -56,7 +59,7 @@ iface = gr.Interface(
56
  gr.inputs.Textbox(type="str", default=text, label="Text", lines=3),
57
  gr.inputs.Dropdown(voices),
58
  ],
59
- outputs="audio",
60
  title="TorToiSe",
61
  description="A multi-voice TTS system trained with an emphasis on quality",
62
  article="This demo shows the ultra fast option in the TorToiSe system. For more info check the <a href='https://github.com/neonbjb/tortoise-tts' target='_blank'>Repository</a>.",
 
11
  from tortoise_tts.api import TextToSpeech
12
  from tortoise_tts.utils.audio import load_audio, get_voices
13
  import torch
14
+ import torchaudio
15
  import gradio as gr
16
 
17
  device = "cuda" if torch.cuda.is_available() else "cpu"
 
48
  conds.append(c)
49
  print(text, conds, preset)
50
  gen = tts.tts_with_preset(text, conds, preset)
51
+ print("gen")
52
+ torchaudio.save('generated.wav', gen.squeeze(0).cpu(), 24000)
53
+ return "generated.wav"
54
 
55
  text = "Joining two modalities results in a surprising increase in generalization! What would happen if we combined them all?"
56
  iface = gr.Interface(
 
59
  gr.inputs.Textbox(type="str", default=text, label="Text", lines=3),
60
  gr.inputs.Dropdown(voices),
61
  ],
62
+ outputs="text",
63
  title="TorToiSe",
64
  description="A multi-voice TTS system trained with an emphasis on quality",
65
  article="This demo shows the ultra fast option in the TorToiSe system. For more info check the <a href='https://github.com/neonbjb/tortoise-tts' target='_blank'>Repository</a>.",