add text to speach
Browse files- app.py +3 -1
- text-to-speach.py → textToSpeach.py +15 -1
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
from image import *
|
2 |
from language import *
|
|
|
3 |
from translation import *
|
4 |
import streamlit as st
|
5 |
import os
|
@@ -12,6 +13,7 @@ st.write('Part 1')
|
|
12 |
|
13 |
question = st.text_input('Posez votre question')
|
14 |
url = st.text_input('mettez le liens de votre image')
|
|
|
15 |
if url :
|
16 |
st.image(url)
|
17 |
|
@@ -30,4 +32,4 @@ if st.button('générer'):
|
|
30 |
st.write('Part 3')
|
31 |
st.write('Next step : TTS')
|
32 |
|
33 |
-
|
|
|
1 |
from image import *
|
2 |
from language import *
|
3 |
+
from textToSpeach import *
|
4 |
from translation import *
|
5 |
import streamlit as st
|
6 |
import os
|
|
|
13 |
|
14 |
question = st.text_input('Posez votre question')
|
15 |
url = st.text_input('mettez le liens de votre image')
|
16 |
+
tts = st.checkbox('lire la réponse')
|
17 |
if url :
|
18 |
st.image(url)
|
19 |
|
|
|
32 |
st.write('Part 3')
|
33 |
st.write('Next step : TTS')
|
34 |
|
35 |
+
speaking(frResponse)
|
text-to-speach.py → textToSpeach.py
RENAMED
@@ -1,6 +1,7 @@
|
|
1 |
from bark import SAMPLE_RATE, generate_audio, preload_models
|
2 |
from scipy.io.wavfile import write as write_wav
|
3 |
from IPython.display import Audio
|
|
|
4 |
|
5 |
# download and load all models
|
6 |
preload_models()
|
@@ -16,4 +17,17 @@ audio_array = generate_audio(text_prompt)
|
|
16 |
write_wav("bark_generation.wav", SAMPLE_RATE, audio_array)
|
17 |
|
18 |
# play text in notebook
|
19 |
-
Audio(audio_array, rate=SAMPLE_RATE)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from bark import SAMPLE_RATE, generate_audio, preload_models
|
2 |
from scipy.io.wavfile import write as write_wav
|
3 |
from IPython.display import Audio
|
4 |
+
from translation import *
|
5 |
|
6 |
# download and load all models
|
7 |
preload_models()
|
|
|
17 |
write_wav("bark_generation.wav", SAMPLE_RATE, audio_array)
|
18 |
|
19 |
# play text in notebook
|
20 |
+
Audio(audio_array, rate=SAMPLE_RATE)
|
21 |
+
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
#### text-to-speach.py
|
26 |
+
|
27 |
+
# ici 'params pourais être carrément 'text_prompt' pour éviter une étape d'assignation supplémentaire.
|
28 |
+
|
29 |
+
def speaking(input):
|
30 |
+
print("####TEXT TO SPEACH####")
|
31 |
+
audio_array = generate_audio(input)
|
32 |
+
write_wav("DoTTS_generation.wav", SAMPLE_RATE, audio_array)
|
33 |
+
Audio(audio_array, rate=SAMPLE_RATE)
|