Spaces:
Runtime error
Runtime error
marigold334
commited on
Commit
โข
93e433e
1
Parent(s):
486e21a
Update app.py
Browse files
app.py
CHANGED
@@ -36,7 +36,7 @@ class TTS:
|
|
36 |
self.voicegenerator.eval()
|
37 |
self.voicegenerator.remove_weight_norm()
|
38 |
|
39 |
-
def inference(self,
|
40 |
filters = '([.,!?])'
|
41 |
sentence = re.sub(re.compile(filters), '', input_text)
|
42 |
x = text_to_sequence(sentence)
|
@@ -70,15 +70,6 @@ def centered_text(input_text, mode = "h1",):
|
|
70 |
st.markdown(
|
71 |
f"<{mode} style='text-align: center;'>{input_text}</{mode}>", unsafe_allow_html = True)
|
72 |
|
73 |
-
def generate_voice(input_text):
|
74 |
-
# TTS Inference
|
75 |
-
voice = st.session_state.TTS.inference(input_text)
|
76 |
-
|
77 |
-
# Play audio
|
78 |
-
st.audio(voice,sample_rate = 22050)
|
79 |
-
st.caption("Generated Voice by" + st.session_state.model_variant)
|
80 |
-
|
81 |
-
|
82 |
init_session_state()
|
83 |
|
84 |
centered_text("๐ ์์ Team Demo")
|
@@ -109,11 +100,13 @@ with col2:
|
|
109 |
update_model()
|
110 |
st.snow()
|
111 |
|
112 |
-
noise_scale = st.slider('noise๋ฅผ ์ถ๊ฐํฉ๋๋ค.', 0., 2., value = 0.
|
113 |
length_scale = st.slider('์๋๋ฅผ ์กฐ์ ํฉ๋๋ค.', 0., 2., value = 1., step = 0.01)
|
114 |
button_gen = st.button("Generate Voice")
|
115 |
if button_gen == True:
|
116 |
-
|
|
|
|
|
117 |
st.balloons()
|
118 |
|
119 |
|
|
|
36 |
self.voicegenerator.eval()
|
37 |
self.voicegenerator.remove_weight_norm()
|
38 |
|
39 |
+
def inference(self, input_text, noise_scale = 0.667, length_scale = 1.0):
|
40 |
filters = '([.,!?])'
|
41 |
sentence = re.sub(re.compile(filters), '', input_text)
|
42 |
x = text_to_sequence(sentence)
|
|
|
70 |
st.markdown(
|
71 |
f"<{mode} style='text-align: center;'>{input_text}</{mode}>", unsafe_allow_html = True)
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
init_session_state()
|
74 |
|
75 |
centered_text("๐ ์์ Team Demo")
|
|
|
100 |
update_model()
|
101 |
st.snow()
|
102 |
|
103 |
+
noise_scale = st.slider('noise๋ฅผ ์ถ๊ฐํฉ๋๋ค.', 0., 2., value = 0.33, step = 0.01)
|
104 |
length_scale = st.slider('์๋๋ฅผ ์กฐ์ ํฉ๋๋ค.', 0., 2., value = 1., step = 0.01)
|
105 |
button_gen = st.button("Generate Voice")
|
106 |
if button_gen == True:
|
107 |
+
voice = st.session_state.TTS.inference(input_text, noise_scale, length_scale)
|
108 |
+
st.audio(voice,sample_rate = 22050)
|
109 |
+
st.caption("Generated Voice by" + st.session_state.model_variant)
|
110 |
st.balloons()
|
111 |
|
112 |
|