Solshine commited on
Commit
29382d3
1 Parent(s): 6d916f4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -47,8 +47,15 @@ prompt = st.chat_input("Copy/Paste or type in text to have read aloud")
47
  if prompt:
48
  st.write(prompt)
49
  with st.popover("✨ Open your text-to-speech from text input ✨"):
50
- sound_file = BytesIO()
51
- tts = gTTS(prompt, lang='en')
52
- tts.write_to_fp(sound_file)
53
 
54
- st.audio(sound_file)
 
 
 
 
 
 
 
 
47
  if prompt:
48
  st.write(prompt)
49
  with st.popover("✨ Open your text-to-speech from text input ✨"):
50
+ #sound_file = BytesIO()
51
+ #tts = gTTS(prompt, lang='en')
52
+ #tts.write_to_fp(sound_file)
53
 
54
+ #st.audio(sound_file)
55
+ # Generate audio for the current page using a unique filename
56
+ page_audio_file = f"output_{i}.wav"
57
+ pipe.generate_to_file(page_audio_file, text)
58
+
59
+ # Display the generated audio using st.audio
60
+ with open(page_audio_file, "rb") as audio_file:
61
+ st.audio(audio_file)