Fixing demo server and html page

pull/10/head
Eren Golge 2018-12-11 15:10:56 +01:00
parent 2ec55e2369
commit 7dfdbae00e
2 changed files with 11 additions and 7 deletions

View File

@ -38,6 +38,7 @@ class Synthesizer(object):
def save_wav(self, wav, path):
# wav *= 32767 / max(1e-8, np.max(np.abs(wav)))
wav = np.array(wav)
self.ap.save_wav(wav, path)
def tts(self, text):
@ -50,7 +51,7 @@ class Synthesizer(object):
sen += '.'
print(sen)
sen = sen.strip()
seq = np.array(text_to_sequence(text, text_cleaner))
seq = np.array(text_to_sequence(sen, text_cleaner))
chars_var = torch.from_numpy(seq).unsqueeze(0).long()
if self.use_cuda:
chars_var = chars_var.cuda()
@ -59,7 +60,7 @@ class Synthesizer(object):
linear_out = linear_out[0].data.cpu().numpy()
wav = self.ap.inv_spectrogram(linear_out.T)
out = io.BytesIO()
wavs.append(wav)
wavs.append(np.zeros(10000))
self.save_wav(wav, out)
return out
wavs += list(wav)
wavs += [0] * 10000
self.save_wav(wavs, out)
return out

View File

@ -29,8 +29,10 @@
</head>
<body>
<a href="https://github.com/mozilla/TTS"><img style="position: absolute; z-index:1000; top: 0; left: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_left_darkblue_121621.png" alt="Fork me on GitHub"></a>
<!-- Navigation -->
<!--
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
<div class="container">
<a class="navbar-brand" href="#">Mozilla TTS</a>
@ -48,13 +50,14 @@
</div>
</div>
</nav>
-->
<!-- Page Content -->
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h1 class="mt-5">Mozilla TTS server example.</h1>
<p class="lead">It is "work-in-progress" with an "far-to-be-alpha" release.</p>
<h1 class="mt-5">Mozilla TTS</h1>
<p class="lead">"work-in-progress"</p>
<ul class="list-unstyled">
</ul>
<input id="text" placeholder="Enter text" size=45 type="text" name="text">