Manmay commited on
Commit
209c75f
1 Parent(s): e4a7cfa

remove save from app

Browse files
Files changed (1) hide show
  1. app.py +5 -19
app.py CHANGED
@@ -47,7 +47,6 @@ VOICE_OPTIONS = [
47
  def inference(
48
  text,
49
  script,
50
- name,
51
  voice,
52
  voice_b,
53
  preset,
@@ -57,10 +56,7 @@ def inference(
57
  ):
58
  if regenerate.strip() == "":
59
  regenerate = None
60
-
61
- if name.strip() == "":
62
- raise gr.Error("No name provided")
63
-
64
  if text is None or text.strip() == "":
65
  with open(script.name) as f:
66
  text = f.read()
@@ -72,8 +68,6 @@ def inference(
72
  else:
73
  texts = split_and_recombine_text(text)
74
 
75
- os.makedirs(os.path.join("longform", name), exist_ok=True)
76
-
77
  if regenerate is not None:
78
  regenerate = list(map(int, regenerate.split()))
79
 
@@ -90,11 +84,6 @@ def inference(
90
 
91
  all_parts = []
92
  for j, text in enumerate(texts):
93
- if regenerate is not None and j + 1 not in regenerate:
94
- all_parts.append(
95
- load_audio(os.path.join("longform", name, f"{j+1}.wav"), 24000)
96
- )
97
- continue
98
  gen = tts.tts_with_preset(
99
  text,
100
  voice_samples=voice_samples,
@@ -104,15 +93,13 @@ def inference(
104
  use_deterministic_seed=seed,
105
  )
106
 
107
- gen = gen.squeeze(0).cpu()
108
- torchaudio.save(os.path.join("longform", name, f"{j+1}.wav"), gen, 24000)
109
-
110
- all_parts.append(gen)
111
 
112
  full_audio = torch.cat(all_parts, dim=-1)
113
 
114
- os.makedirs("outputs", exist_ok=True)
115
- torchaudio.save(os.path.join("outputs", f"{name}.wav"), full_audio, 24000)
116
 
117
  with open("Tortoise_TTS_Runs_Scripts.log", "a") as f:
118
  f.write(
@@ -169,7 +156,6 @@ def main():
169
  inputs=[
170
  text,
171
  script,
172
- name,
173
  voice,
174
  voice_b,
175
  preset,
 
47
  def inference(
48
  text,
49
  script,
 
50
  voice,
51
  voice_b,
52
  preset,
 
56
  ):
57
  if regenerate.strip() == "":
58
  regenerate = None
59
+ name = "generated.wav"
 
 
 
60
  if text is None or text.strip() == "":
61
  with open(script.name) as f:
62
  text = f.read()
 
68
  else:
69
  texts = split_and_recombine_text(text)
70
 
 
 
71
  if regenerate is not None:
72
  regenerate = list(map(int, regenerate.split()))
73
 
 
84
 
85
  all_parts = []
86
  for j, text in enumerate(texts):
 
 
 
 
 
87
  gen = tts.tts_with_preset(
88
  text,
89
  voice_samples=voice_samples,
 
93
  use_deterministic_seed=seed,
94
  )
95
 
96
+ audio_ = gen.squeeze(0).cpu()
97
+ all_parts.append(audio_)
 
 
98
 
99
  full_audio = torch.cat(all_parts, dim=-1)
100
 
101
+ # os.makedirs("outputs", exist_ok=True)
102
+ # torchaudio.save(os.path.join("outputs", f"{name}.wav"), full_audio, 24000)
103
 
104
  with open("Tortoise_TTS_Runs_Scripts.log", "a") as f:
105
  f.write(
 
156
  inputs=[
157
  text,
158
  script,
 
159
  voice,
160
  voice_b,
161
  preset,