Spaces:
Running
on
T4
Running
on
T4
github-actions[bot]
commited on
Commit
·
412197e
1
Parent(s):
4657892
Sync with https://github.com/mozilla-ai/document-to-podcast
Browse files
app.py
CHANGED
@@ -56,6 +56,7 @@ def gen_button_clicked():
|
|
56 |
st.session_state[gen_button] = True
|
57 |
|
58 |
|
|
|
59 |
st.title("Document To Podcast")
|
60 |
|
61 |
st.header("Upload a File")
|
@@ -166,6 +167,7 @@ if "clean_text" in st.session_state:
|
|
166 |
# Get which language is used for generation from the first character of the Kokoro voice profile
|
167 |
language_code = speakers[0]["voice_profile"][0]
|
168 |
speech_model = load_text_to_speech_model(lang_code=language_code)
|
|
|
169 |
|
170 |
system_prompt = DEFAULT_PROMPT.replace("{SPEAKERS}", speakers_str)
|
171 |
with st.spinner("Generating Podcast..."):
|
@@ -190,7 +192,7 @@ if "clean_text" in st.session_state:
|
|
190 |
speech_model,
|
191 |
voice_profile,
|
192 |
)
|
193 |
-
st.audio(speech, sample_rate=
|
194 |
|
195 |
st.session_state.audio.append(speech)
|
196 |
text = ""
|
@@ -198,9 +200,9 @@ if "clean_text" in st.session_state:
|
|
198 |
|
199 |
if st.session_state[gen_button]:
|
200 |
audio_np = stack_audio_segments(
|
201 |
-
st.session_state.audio,
|
202 |
)
|
203 |
-
audio_wav = numpy_to_wav(audio_np,
|
204 |
if st.download_button(
|
205 |
label="Save Podcast to audio file",
|
206 |
data=audio_wav,
|
|
|
56 |
st.session_state[gen_button] = True
|
57 |
|
58 |
|
59 |
+
sample_rate = 24000
|
60 |
st.title("Document To Podcast")
|
61 |
|
62 |
st.header("Upload a File")
|
|
|
167 |
# Get which language is used for generation from the first character of the Kokoro voice profile
|
168 |
language_code = speakers[0]["voice_profile"][0]
|
169 |
speech_model = load_text_to_speech_model(lang_code=language_code)
|
170 |
+
sample_rate = speech_model.sample_rate
|
171 |
|
172 |
system_prompt = DEFAULT_PROMPT.replace("{SPEAKERS}", speakers_str)
|
173 |
with st.spinner("Generating Podcast..."):
|
|
|
192 |
speech_model,
|
193 |
voice_profile,
|
194 |
)
|
195 |
+
st.audio(speech, sample_rate=sample_rate)
|
196 |
|
197 |
st.session_state.audio.append(speech)
|
198 |
text = ""
|
|
|
200 |
|
201 |
if st.session_state[gen_button]:
|
202 |
audio_np = stack_audio_segments(
|
203 |
+
st.session_state.audio, sample_rate, silence_pad=0.0
|
204 |
)
|
205 |
+
audio_wav = numpy_to_wav(audio_np, sample_rate)
|
206 |
if st.download_button(
|
207 |
label="Save Podcast to audio file",
|
208 |
data=audio_wav,
|