danny042 commited on
Commit
0799131
โ€ข
1 Parent(s): 570e94b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -8
app.py CHANGED
@@ -20,7 +20,6 @@ from gtts import gTTS
20
  from IPython.display import Audio, display
21
 
22
  from pydub import AudioSegment
23
- import simpleaudio as sa
24
 
25
  #์‚ฌ์ดํŠธ ๊ด€๋ จ ํ•จ์ˆ˜
26
  def main():
@@ -88,13 +87,10 @@ def main():
88
  tts.save('output.mp3') # ์Œ์„ฑ ํŒŒ์ผ ์ €์žฅ
89
 
90
  # ์Œ์„ฑ ํŒŒ์ผ ๋กœ๋“œ
91
- audio = AudioSegment.from_file("output.mp3")
92
- audio.export("temp.wav", format="wav") # wav ํ˜•์‹์œผ๋กœ ๋ณ€ํ™˜
93
-
94
- # ์Œ์„ฑ ์žฌ์ƒ
95
- wave_obj = sa.WaveObject.from_wave_file("temp.wav")
96
- play_obj = wave_obj.play()
97
- play_obj.wait_done()
98
 
99
  st.markdown(response)
100
  with st.expander("์ฐธ๊ณ  ๋ฌธ์„œ ํ™•์ธ"):
 
20
  from IPython.display import Audio, display
21
 
22
  from pydub import AudioSegment
 
23
 
24
  #์‚ฌ์ดํŠธ ๊ด€๋ จ ํ•จ์ˆ˜
25
  def main():
 
87
  tts.save('output.mp3') # ์Œ์„ฑ ํŒŒ์ผ ์ €์žฅ
88
 
89
  # ์Œ์„ฑ ํŒŒ์ผ ๋กœ๋“œ
90
+ audio = AudioSegment.from_file("output.mp3", format="mp3")
91
+
92
+ # Streamlit์—์„œ ์Œ์„ฑ ์žฌ์ƒ
93
+ st.audio(audio.export(format='mp3').read(), format='audio/mp3')
 
 
 
94
 
95
  st.markdown(response)
96
  with st.expander("์ฐธ๊ณ  ๋ฌธ์„œ ํ™•์ธ"):