Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
from transformers import pipeline
|
|
|
|
|
2 |
|
3 |
# Initialize the translation pipeline for Russian to English
|
4 |
translator = pipeline("translation_ru_to_en", model="Helsinki-NLP/opus-mt-ru-en")
|
@@ -14,5 +16,11 @@ translation = translator(text)[0]['translation_text']
|
|
14 |
print("Translated Text: ", translation)
|
15 |
|
16 |
# Summarize the translated text
|
17 |
-
summary = summarizer(
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from transformers import pipeline
|
2 |
+
from TTS.api import TTS
|
3 |
+
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2", gpu=True)
|
4 |
|
5 |
# Initialize the translation pipeline for Russian to English
|
6 |
translator = pipeline("translation_ru_to_en", model="Helsinki-NLP/opus-mt-ru-en")
|
|
|
16 |
print("Translated Text: ", translation)
|
17 |
|
18 |
# Summarize the translated text
|
19 |
+
summary = summarizer(translation, max_length=140, min_length=110, do_sample=False)[0]['summary_text']
|
20 |
+
|
21 |
+
print("Summary: ", summary)
|
22 |
+
|
23 |
+
tts.tts_to_file(text=summary,
|
24 |
+
file_path="output.wav",
|
25 |
+
speaker_wav="/speaker.wav",
|
26 |
+
language="en")
|