Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
from IPython.display import Audio
|
3 |
+
|
4 |
+
# Initialize the text-to-speech pipeline with the desired model
|
5 |
+
pipe = pipeline("text-to-speech", model="kotoba-tech/kotoba-speech-v0.1")
|
6 |
+
|
7 |
+
# Input text
|
8 |
+
text = "Don't count the days, make the days count."
|
9 |
+
|
10 |
+
# Generate speech from text
|
11 |
+
narrated_text = pipe(text)
|
12 |
+
|
13 |
+
# Display the audio
|
14 |
+
Audio(narrated_text["audio"], rate=narrated_text["sampling_rate"])
|