develops20 commited on
Commit
9a4cedc
·
verified ·
1 Parent(s): c1732f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -11,7 +11,7 @@ whisper = pipeline("automatic-speech-recognition", model="openai/whisper-tiny")
11
  knowledge_base = {
12
  "what cars are available": "We have Toyota Camry, Honda Civic, and Ford Mustang.",
13
  "price of camry": "The Toyota Camry starts at $25,000.",
14
- "price of Tesla": "The Tesla starts at $60,000."
15
  }
16
 
17
  def transcribe(audio):
@@ -35,9 +35,10 @@ def text_to_speech(text):
35
  print(f"Generating speech for text: {text}")
36
  try:
37
  tts = gTTS(text, lang="en")
38
- tts.save("response.mp3")
39
- print("Speech saved to response.mp3")
40
- return "response.mp3"
 
41
  except Exception as e:
42
  print(f"Error in text_to_speech: {str(e)}")
43
  import traceback
 
11
  knowledge_base = {
12
  "what cars are available": "We have Toyota Camry, Honda Civic, and Ford Mustang.",
13
  "price of camry": "The Toyota Camry starts at $25,000.",
14
+ "price of tesla": "The Tesla starts at $60,000."
15
  }
16
 
17
  def transcribe(audio):
 
35
  print(f"Generating speech for text: {text}")
36
  try:
37
  tts = gTTS(text, lang="en")
38
+ output_path = "/tmp/response.mp3"
39
+ tts.save(output_path)
40
+ print(f"Speech saved to {output_path}")
41
+ return output_path
42
  except Exception as e:
43
  print(f"Error in text_to_speech: {str(e)}")
44
  import traceback