wannaphong commited on
Commit
8dc76bc
·
1 Parent(s): ca631c5

Update pages/last_checkpoint.py

Browse files
Files changed (1) hide show
  1. pages/last_checkpoint.py +2 -1
pages/last_checkpoint.py CHANGED
@@ -1,5 +1,6 @@
1
  import streamlit as st
2
  from pythaitts import TTS
 
3
  st.title("PyThaiTTS Demo")
4
  tts = TTS(pretrained="khanomtan", mode="last_checkpoint")
5
  st.markdown("""
@@ -23,6 +24,6 @@ with form:
23
  submitted = st.form_submit_button(label="Submit")
24
 
25
  if submitted:
26
- audio_file = tts.tts(text=str(text), speaker_idx=str(speaker_idx), language_idx=str(language))
27
  audio_bytes = open(audio_file,"rb").read()
28
  st.audio(audio_bytes, format='audio/wav')
 
1
  import streamlit as st
2
  from pythaitts import TTS
3
+ from pythainlp.tokenize import word_tokenize
4
  st.title("PyThaiTTS Demo")
5
  tts = TTS(pretrained="khanomtan", mode="last_checkpoint")
6
  st.markdown("""
 
24
  submitted = st.form_submit_button(label="Submit")
25
 
26
  if submitted:
27
+ audio_file = tts.tts(text=' '.join(word_tokenize(str(text))).replace(' ',' '), speaker_idx=str(speaker_idx), language_idx=str(language))
28
  audio_bytes = open(audio_file,"rb").read()
29
  st.audio(audio_bytes, format='audio/wav')