Spaces:
Build error
Build error
DSatishchandra
commited on
Commit
•
180bd84
1
Parent(s):
f18f270
Update order_assistant.py
Browse files- order_assistant.py +8 -7
order_assistant.py
CHANGED
@@ -56,13 +56,14 @@ 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 |
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?"
|
|
|
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?"
|