Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
import soundfile as sf
|
4 |
-
import numpy as np
|
5 |
|
6 |
# Define translation models
|
7 |
translation_models = {
|
@@ -14,8 +13,8 @@ translation_models = {
|
|
14 |
"Pashto": "Helsinki-NLP/opus-mt-en-ps"
|
15 |
}
|
16 |
|
17 |
-
#
|
18 |
-
tts_model_name = "
|
19 |
tts_pipeline = pipeline("text-to-speech", model=tts_model_name)
|
20 |
|
21 |
# Function to translate text
|
@@ -66,3 +65,4 @@ if st.button("Translate and Generate Audio"):
|
|
66 |
|
67 |
# Footer
|
68 |
st.write("Powered by Hugging Face Transformers and TTS")
|
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
import soundfile as sf
|
|
|
4 |
|
5 |
# Define translation models
|
6 |
translation_models = {
|
|
|
13 |
"Pashto": "Helsinki-NLP/opus-mt-en-ps"
|
14 |
}
|
15 |
|
16 |
+
# Define TTS model
|
17 |
+
tts_model_name = "facebook/fastspeech2-en-ljspeech"
|
18 |
tts_pipeline = pipeline("text-to-speech", model=tts_model_name)
|
19 |
|
20 |
# Function to translate text
|
|
|
65 |
|
66 |
# Footer
|
67 |
st.write("Powered by Hugging Face Transformers and TTS")
|
68 |
+
|