Update handler.py
Browse files- handler.py +4 -5
handler.py
CHANGED
|
@@ -11,7 +11,6 @@ logging.basicConfig(level=logging.ERROR)
|
|
| 11 |
# Configure logging
|
| 12 |
logging.basicConfig(level=logging.WARNING)
|
| 13 |
|
| 14 |
-
import streamlit as st
|
| 15 |
import pygame
|
| 16 |
|
| 17 |
class EndpointHandler():
|
|
@@ -33,10 +32,10 @@ class EndpointHandler():
|
|
| 33 |
|
| 34 |
# Save the audio to a file
|
| 35 |
sf.write("StoryAudio.wav", outputs["waveform"][0].numpy(), self.model.config.sampling_rate)
|
| 36 |
-
st.audio("StoryAudio.wav")
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
#return 'StoryAudio.wav'
|
| 41 |
#return {"audio_file_path": 'StoryAudio.wav'}
|
| 42 |
# with open("StoryAudio.wav", "rb") as f:
|
|
|
|
| 11 |
# Configure logging
|
| 12 |
logging.basicConfig(level=logging.WARNING)
|
| 13 |
|
|
|
|
| 14 |
import pygame
|
| 15 |
|
| 16 |
class EndpointHandler():
|
|
|
|
| 32 |
|
| 33 |
# Save the audio to a file
|
| 34 |
sf.write("StoryAudio.wav", outputs["waveform"][0].numpy(), self.model.config.sampling_rate)
|
| 35 |
+
#st.audio("StoryAudio.wav")
|
| 36 |
+
pygame.mixer.init()
|
| 37 |
+
pygame.mixer.music.load("StoryAudio.wav")
|
| 38 |
+
pygame.mixer.music.play()
|
| 39 |
#return 'StoryAudio.wav'
|
| 40 |
#return {"audio_file_path": 'StoryAudio.wav'}
|
| 41 |
# with open("StoryAudio.wav", "rb") as f:
|