geethareddy commited on
Commit
7fdab26
·
verified ·
1 Parent(s): 66e5ea3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -8,11 +8,11 @@ from gtts import gTTS
8
  app = Flask(__name__)
9
  recognizer = sr.Recognizer()
10
 
11
- # Load Hugging Face Whisper Model
12
  device = "cuda" if torch.cuda.is_available() else "cpu"
13
  speech_to_text = pipeline("automatic-speech-recognition", model="openai/whisper-base", device=0 if device == "cuda" else -1)
14
 
15
- # Function to convert text to speech
16
  def generate_audio(text, filename="static/output.mp3"):
17
  tts = gTTS(text=text, lang="en")
18
  tts.save(filename)
 
8
  app = Flask(__name__)
9
  recognizer = sr.Recognizer()
10
 
11
+ # Load Hugging Face Whisper Model for Speech-to-Text
12
  device = "cuda" if torch.cuda.is_available() else "cpu"
13
  speech_to_text = pipeline("automatic-speech-recognition", model="openai/whisper-base", device=0 if device == "cuda" else -1)
14
 
15
+ # Function to generate and play voice prompts
16
  def generate_audio(text, filename="static/output.mp3"):
17
  tts = gTTS(text=text, lang="en")
18
  tts.save(filename)