DSatishchandra commited on
Commit
a6ae8fd
1 Parent(s): 180bd84

Update order_assistant.py

Browse files
Files changed (1) hide show
  1. order_assistant.py +7 -8
order_assistant.py CHANGED
@@ -56,14 +56,13 @@ class OrderAssistant:
56
  except sr.RequestError:
57
  return "Sorry, I'm having trouble reaching the service"
58
 
59
- async def text_to_speech(self, text):
60
- # Change pitch from '0Hz' to a valid value, e.g., '+0Hz'
61
- communicate = edge_tts.Communicate(text, "en-US-AriaNeural", rate="+0%", pitch="+0Hz") # Changed '0Hz' to '+0Hz'
62
- with tempfile.NamedTemporaryFile(delete=False, suffix=".mp3") as tmp_file:
63
- tmp_path = tmp_file.name
64
- await communicate.save(tmp_path)
65
- return tmp_path
66
-
67
 
68
  async def food_order_assistant(self, audio_input, food_type):
69
  greeting_text = "Welcome to the restaurant! What would you like to order today? Are you looking for Vegan, Halal, or Guilt-Free options?"
 
56
  except sr.RequestError:
57
  return "Sorry, I'm having trouble reaching the service"
58
 
59
+ async def text_to_speech(self, text):
60
+ # Ensure consistent indentation for the body of the function
61
+ communicate = edge_tts.Communicate(text, "en-US-AriaNeural", rate="+0%", pitch="+0Hz") # Fixed indentation
62
+ with tempfile.NamedTemporaryFile(delete=False, suffix=".mp3") as tmp_file:
63
+ tmp_path = tmp_file.name
64
+ await communicate.save(tmp_path)
65
+ return tmp_path
 
66
 
67
  async def food_order_assistant(self, audio_input, food_type):
68
  greeting_text = "Welcome to the restaurant! What would you like to order today? Are you looking for Vegan, Halal, or Guilt-Free options?"