SuganthKrishna2003 commited on
Commit
24be09f
1 Parent(s): 53e5a1a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -12
app.py CHANGED
@@ -98,18 +98,16 @@ response = get_completion(prompt)
98
 
99
  print(response)
100
 
101
- # Importing a English Text-To-Speech Model from huggingface
 
 
 
 
 
102
 
103
- tts_model = BarkModel.from_pretrained("suno/bark-small")
104
- tts_processor = BarkProcessor.from_pretrained("suno/bark-small")
105
 
106
- # Preprocessing the text data using imported preprocessor and generating output from model
107
 
108
- inputs = tts_processor(response, voice_preset="v2/en_speaker_3")
109
-
110
- speech_output = tts_model.generate(**inputs).cpu().numpy()
111
-
112
- # Output of generated speech
113
-
114
- sampling_rate = tts_model.generation_config.sample_rate
115
- Audio(speech_output[0], rate=sampling_rate)
 
98
 
99
  print(response)
100
 
101
+ # Import the Gtts module for text
102
+ # to speech conversion
103
+ from gtts import gTTS
104
+
105
+ # import Os module to start the audio file
106
+ import os
107
 
108
+ # Language we want to use
109
+ language = 'en'
110
 
111
+ output = gTTS(text=response, lang=language, slow=False)
112
 
113
+ Audio(output,rate=24000)