Update handler.py
Browse files- handler.py +2 -0
handler.py
CHANGED
|
@@ -4,6 +4,7 @@ import torch
|
|
| 4 |
import soundfile as sf
|
| 5 |
from transformers import AutoTokenizer, AutoModelForTextToWaveform
|
| 6 |
import cloudinary.uploader
|
|
|
|
| 7 |
# Configure logging
|
| 8 |
logging.basicConfig(level=logging.DEBUG)
|
| 9 |
# Configure logging
|
|
@@ -34,6 +35,7 @@ class EndpointHandler():
|
|
| 34 |
# Save the audio to a file
|
| 35 |
sf.write("StoryAudio.wav", outputs["waveform"][0].numpy(), self.model.config.sampling_rate)
|
| 36 |
uploadGraphFile("StoryAudio.wav")
|
|
|
|
| 37 |
return 'StoryAudio.wav'
|
| 38 |
# Check if the request was successful
|
| 39 |
|
|
|
|
| 4 |
import soundfile as sf
|
| 5 |
from transformers import AutoTokenizer, AutoModelForTextToWaveform
|
| 6 |
import cloudinary.uploader
|
| 7 |
+
import streamlit as st
|
| 8 |
# Configure logging
|
| 9 |
logging.basicConfig(level=logging.DEBUG)
|
| 10 |
# Configure logging
|
|
|
|
| 35 |
# Save the audio to a file
|
| 36 |
sf.write("StoryAudio.wav", outputs["waveform"][0].numpy(), self.model.config.sampling_rate)
|
| 37 |
uploadGraphFile("StoryAudio.wav")
|
| 38 |
+
st.audio("StoryAudio.wav")
|
| 39 |
return 'StoryAudio.wav'
|
| 40 |
# Check if the request was successful
|
| 41 |
|