File size: 1,921 Bytes
b546670
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0fff674
b546670
1139791
 
 
0fff674
1139791
 
b546670
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Utils
import os
import soundfile as sf

# Streamlit
import streamlit as st

# Custom elements
from elements.component import (
    centered_text,
)
from elements.session_states import (
    init_session_state,
    update_session_state,
    update_model,
)
from elements.tts import (
    generate_voice,
)

st.set_page_config(
    page_title = "Nix-TTS Interactive Demo",
    page_icon = "🐤",
)

# Initiate stuffs
init_session_state()

# ---------------------------------------------------------------------------------

# Description
centered_text("🐤 Nix-TTS Interactive Demo")
centered_text("Lightweight and End-to-end Text-to-Speech via Module-wise Distillation", "h5")
st.write(" ")

mode = "p"
st.markdown(
    f"<{mode} style='text-align: left;'><small>🗒️ This is a demo from our latest paper, <b>Nix-TTS</b> (Accepted to IEEE SLT 2022)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;You can access the paper and the released models <a href='https://github.com/rendchevi/nix-tts'>here</a><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Authors: Rendi Chevi, Radityo Eko Prasojo, Alham Fikri Aji, Andros Tjandra, Sakriani Sakti Aji.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Corresponding Author: Rendi Chevi, rendi.chevi@&#123kata.ai, gmail.com&#125</small></{mode}>",
    unsafe_allow_html = True
)

# Model demo
st.write(" ")
st.write(" ")
col1, col2 = st.columns(2)
with col1:
    input_text = st.text_input(
        "Input Text",
        value = "Born to multiply, born to gaze into night skies.",
    )
with col2:
    model_variant = st.selectbox("Choose Model Variant", options = ["Deterministic", "Stochastic"], index = 1)
    if model_variant != st.session_state.model_variant:
        # Update variant choice
        update_session_state("model_variant", model_variant)
        # Re-load model
        update_model()

button_gen = st.button("Generate Voice")
if button_gen == True:
    generate_voice(input_text)