fargerm commited on
Commit
ecc5179
1 Parent(s): 0310b5b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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
- # Use a different TTS model that does not require speaker embeddings
18
- tts_model_name = "tts_models/en/ljspeech/tacotron2-DDC" # Example model
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
+