nagasurendra commited on
Commit
c2f90f0
·
verified ·
1 Parent(s): c74d59f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -8,6 +8,7 @@ import queue
8
  import threading
9
  from scipy.io.wavfile import write
10
  import speech_recognition as sr
 
11
 
12
  # Store cart in a temporary storage
13
  cart = []
@@ -31,17 +32,15 @@ def generate_voice_response(text):
31
  tts.save(temp_file.name)
32
  return temp_file.name
33
 
34
- def calculate_total(cart):
35
- return sum(menu_items[item] for item in cart)
36
-
37
  def play_audio(audio_path):
38
- import simpleaudio as sa
39
  try:
40
- playback = sa.WaveObject.from_wave_file(audio_path).play()
41
- playback.wait_done()
42
  except Exception as e:
43
  print("Error playing audio:", e)
44
 
 
 
 
45
  # Audio recording setup
46
  q = queue.Queue()
47
  def audio_callback(indata, frames, time, status):
 
8
  import threading
9
  from scipy.io.wavfile import write
10
  import speech_recognition as sr
11
+ import subprocess
12
 
13
  # Store cart in a temporary storage
14
  cart = []
 
32
  tts.save(temp_file.name)
33
  return temp_file.name
34
 
 
 
 
35
  def play_audio(audio_path):
 
36
  try:
37
+ subprocess.run(["ffplay", "-nodisp", "-autoexit", audio_path], check=True)
 
38
  except Exception as e:
39
  print("Error playing audio:", e)
40
 
41
+ def calculate_total(cart):
42
+ return sum(menu_items[item] for item in cart)
43
+
44
  # Audio recording setup
45
  q = queue.Queue()
46
  def audio_callback(indata, frames, time, status):