Spaces:
Build error
Build error
DSatishchandra
commited on
Commit
•
a6ae8fd
1
Parent(s):
180bd84
Update order_assistant.py
Browse files- 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 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
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?"
|