abderrahimbrighal commited on
Commit
d6a15ae
·
verified ·
1 Parent(s): 0b914aa

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
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"])