upload tts test
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ from language import *
|
|
3 |
from textToSpeach import *
|
4 |
from translation import *
|
5 |
import streamlit as st
|
6 |
-
import
|
7 |
|
8 |
|
9 |
# url = "https://i.imgur.com/qs0CxjE_d.webp?maxwidth=760&fidelity=grand"
|
@@ -34,6 +34,24 @@ if st.button('générer'):
|
|
34 |
if tts:
|
35 |
st.write('le TTS est en cours de chargement')
|
36 |
st.audio(speaking(frResponse))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
else:
|
38 |
st.write('Pas de tts demander')
|
39 |
|
|
|
3 |
from textToSpeach import *
|
4 |
from translation import *
|
5 |
import streamlit as st
|
6 |
+
import base64
|
7 |
|
8 |
|
9 |
# url = "https://i.imgur.com/qs0CxjE_d.webp?maxwidth=760&fidelity=grand"
|
|
|
34 |
if tts:
|
35 |
st.write('le TTS est en cours de chargement')
|
36 |
st.audio(speaking(frResponse))
|
37 |
+
def autoplay_audio(file_path: str):
|
38 |
+
with open(file_path, "rb") as f:
|
39 |
+
data = f.read()
|
40 |
+
b64 = base64.b64encode(data).decode()
|
41 |
+
md = f"""
|
42 |
+
<audio controls autoplay="true">
|
43 |
+
<source src="data:audio/mp3;base64,{b64}" type="audio/mp3">
|
44 |
+
</audio>
|
45 |
+
"""
|
46 |
+
st.markdown(
|
47 |
+
md,
|
48 |
+
unsafe_allow_html=True,
|
49 |
+
)
|
50 |
+
|
51 |
+
|
52 |
+
st.write("# Auto-playing Audio!")
|
53 |
+
|
54 |
+
autoplay_audio("DoTTS_generation.wav")
|
55 |
else:
|
56 |
st.write('Pas de tts demander')
|
57 |
|