Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
from transformers import pipeline
|
2 |
-
from
|
3 |
-
|
4 |
|
5 |
# Initialize the translation pipeline for Russian to English
|
6 |
translator = pipeline("translation_ru_to_en", model="Helsinki-NLP/opus-mt-ru-en")
|
@@ -20,7 +20,11 @@ summary = summarizer(translation, max_length=140, min_length=110, do_sample=Fals
|
|
20 |
|
21 |
print("Summary: ", summary)
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
1 |
from transformers import pipeline
|
2 |
+
from transformers import DiffusionTextToSpeechPipeline
|
3 |
+
|
4 |
|
5 |
# Initialize the translation pipeline for Russian to English
|
6 |
translator = pipeline("translation_ru_to_en", model="Helsinki-NLP/opus-mt-ru-en")
|
|
|
20 |
|
21 |
print("Summary: ", summary)
|
22 |
|
23 |
+
pipeline = DiffusionTextToSpeechPipeline.from_pretrained("microsoft/tts-diffusion-xlarge-en")
|
24 |
+
|
25 |
+
# Generate speech
|
26 |
+
speech = pipeline(summary)
|
27 |
+
|
28 |
+
# Save the output
|
29 |
+
with open("output.wav", "wb") as f:
|
30 |
+
f.write(speech["sampling_rate"].get_wav_data())
|