rishikesh commited on
Commit
63fe7c2
·
1 Parent(s): 38805e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -17
app.py CHANGED
@@ -36,22 +36,9 @@ def main():
36
  st.write(generated_text)
37
  generated_audio = gTTS(generated_text)
38
  generated_audio.save('demo.mp3')
39
- html_string = """
40
- <audio controls autoplay>
41
- <source src="demo.mp3" type="audio/mp3">
42
- </audio>
43
- """
44
-
45
- sound = st.empty()
46
- sound.markdown(html_string, unsafe_allow_html=True) # will display a st.audio with the sound you specified in the "src" of the
47
- # html_string and autoplay it
48
- time.sleep(2) # wait for 2 seconds to finish the playing of the audio
49
- # sound.empty()
50
- #audio_file = open('demo.mp3', 'rb')
51
- #audio_bytes = audio_file.read()
52
- #st.audio(audio_bytes, format='audio/ogg',start_time=0)
53
 
54
  if __name__ == '__main__' :
55
- main()
56
-
57
- # optionally delete the element afterwards
 
36
  st.write(generated_text)
37
  generated_audio = gTTS(generated_text)
38
  generated_audio.save('demo.mp3')
39
+ audio_file = open('demo.mp3', 'rb')
40
+ audio_bytes = audio_file.read()
41
+ st.audio(audio_bytes, format='audio/ogg',start_time=0)
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  if __name__ == '__main__' :
44
+ main()