Pranjal12345 commited on
Commit
deb14ad
·
1 Parent(s): 97e4faf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -33
app.py CHANGED
@@ -15,7 +15,6 @@ VOICE_OPTIONS = [
15
  "random", # special option for random voice
16
  ]
17
 
18
-
19
  def inference(
20
  text,
21
  script,
@@ -46,7 +45,6 @@ def inference(
46
 
47
  start_time = time.time()
48
 
49
- # all_parts = []
50
  for j, text in enumerate(texts):
51
  for audio_frame in tts.tts_with_preset(
52
  text,
@@ -55,26 +53,11 @@ def inference(
55
  preset="ultra_fast",
56
  k=1
57
  ):
58
- # print("Time taken: ", time.time() - start_time)
59
- # all_parts.append(audio_frame)
60
  yield (24000, audio_frame.cpu().detach().numpy())
61
 
62
- # wav = torch.cat(all_parts, dim=0).unsqueeze(0)
63
- # print(wav.shape)
64
- # torchaudio.save("output.wav", wav.cpu(), 24000)
65
- # yield (None, gr.make_waveform(audio="output.wav",))
66
  def main():
67
- title = "Tortoise TTS 🐢"
68
- description = """
69
- A text-to-speech system which powers lot of organizations in Speech synthesis domain.
70
- <br/>
71
- a model with strong multi-voice capabilities, highly realistic prosody and intonation.
72
- <br/>
73
- for faster inference, use the 'ultra_fast' preset and duplicate space if you don't want to wait in a queue.
74
- <br/>
75
- """
76
- text = gr.Textbox(
77
- lines=4,
78
  label="Text (Provide either text, or upload a newline separated text file below):",
79
  )
80
  script = gr.File(label="Upload a text file")
@@ -96,7 +79,6 @@ def main():
96
  )
97
 
98
  output_audio = gr.Audio(label="streaming audio:", streaming=True, autoplay=True)
99
- # download_audio = gr.Audio(label="dowanload audio:")
100
  interface = gr.Interface(
101
  fn=inference,
102
  inputs=[
@@ -107,18 +89,6 @@ def main():
107
  split_by_newline,
108
  ],
109
  title=title,
110
- description=description,
111
  outputs=[output_audio],
112
  )
113
- interface.queue().launch()
114
-
115
-
116
- if __name__ == "__main__":
117
- tts = TextToSpeech(kv_cache=True, use_deepspeed=True, half=True)
118
-
119
- with open("Tortoise_TTS_Runs_Scripts.log", "a") as f:
120
- f.write(
121
- f"\n\n-------------------------Tortoise TTS Scripts Logs, {datetime.now()}-------------------------\n"
122
- )
123
-
124
- main()
 
15
  "random", # special option for random voice
16
  ]
17
 
 
18
  def inference(
19
  text,
20
  script,
 
45
 
46
  start_time = time.time()
47
 
 
48
  for j, text in enumerate(texts):
49
  for audio_frame in tts.tts_with_preset(
50
  text,
 
53
  preset="ultra_fast",
54
  k=1
55
  ):
 
 
56
  yield (24000, audio_frame.cpu().detach().numpy())
57
 
 
 
 
 
58
  def main():
59
+ title = "Tortoise TTS "
60
+
 
 
 
 
 
 
 
 
 
61
  label="Text (Provide either text, or upload a newline separated text file below):",
62
  )
63
  script = gr.File(label="Upload a text file")
 
79
  )
80
 
81
  output_audio = gr.Audio(label="streaming audio:", streaming=True, autoplay=True)
 
82
  interface = gr.Interface(
83
  fn=inference,
84
  inputs=[
 
89
  split_by_newline,
90
  ],
91
  title=title,
 
92
  outputs=[output_audio],
93
  )
94
+ interface.queue().launch()