Spaces:
Runtime error
Runtime error
github-actions[bot]
commited on
Commit
·
6b39985
1
Parent(s):
a4a7f53
Sync with https://github.com/mozilla-ai/document-to-podcast
Browse files
app.py
CHANGED
|
@@ -3,7 +3,6 @@
|
|
| 3 |
import re
|
| 4 |
from pathlib import Path
|
| 5 |
|
| 6 |
-
import numpy as np
|
| 7 |
import soundfile as sf
|
| 8 |
import streamlit as st
|
| 9 |
|
|
@@ -15,6 +14,7 @@ from document_to_podcast.inference.model_loaders import (
|
|
| 15 |
from document_to_podcast.config import DEFAULT_PROMPT, DEFAULT_SPEAKERS, Speaker
|
| 16 |
from document_to_podcast.inference.text_to_speech import text_to_speech
|
| 17 |
from document_to_podcast.inference.text_to_text import text_to_text_stream
|
|
|
|
| 18 |
|
| 19 |
|
| 20 |
@st.cache_resource
|
|
@@ -173,7 +173,9 @@ if "clean_text" in st.session_state:
|
|
| 173 |
|
| 174 |
if st.session_state[gen_button]:
|
| 175 |
if st.button("Save Podcast to audio file"):
|
| 176 |
-
st.session_state.audio =
|
|
|
|
|
|
|
| 177 |
sf.write(
|
| 178 |
"podcast.wav",
|
| 179 |
st.session_state.audio,
|
|
|
|
| 3 |
import re
|
| 4 |
from pathlib import Path
|
| 5 |
|
|
|
|
| 6 |
import soundfile as sf
|
| 7 |
import streamlit as st
|
| 8 |
|
|
|
|
| 14 |
from document_to_podcast.config import DEFAULT_PROMPT, DEFAULT_SPEAKERS, Speaker
|
| 15 |
from document_to_podcast.inference.text_to_speech import text_to_speech
|
| 16 |
from document_to_podcast.inference.text_to_text import text_to_text_stream
|
| 17 |
+
from document_to_podcast.utils import stack_audio_segments
|
| 18 |
|
| 19 |
|
| 20 |
@st.cache_resource
|
|
|
|
| 173 |
|
| 174 |
if st.session_state[gen_button]:
|
| 175 |
if st.button("Save Podcast to audio file"):
|
| 176 |
+
st.session_state.audio = stack_audio_segments(
|
| 177 |
+
st.session_state.audio, speech_model.audio_codec.sr
|
| 178 |
+
)
|
| 179 |
sf.write(
|
| 180 |
"podcast.wav",
|
| 181 |
st.session_state.audio,
|