nagasurendra commited on
Commit
d7d506a
·
verified ·
1 Parent(s): 989231a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -78,12 +78,6 @@ def process_audio(audio_path):
78
  audio_response_path = generate_voice_response(response)
79
  return response, audio_response_path
80
 
81
- def background_listen():
82
- while True:
83
- print("Listening...")
84
- time.sleep(2)
85
-
86
- # Gradio Interface
87
  def run_assistant(audio):
88
  transcription, audio_response_path = process_audio(audio)
89
  os.system(f"start {audio_response_path}") # Automatically play the response audio
@@ -91,8 +85,10 @@ def run_assistant(audio):
91
 
92
  with gr.Blocks() as demo:
93
  gr.Markdown("# Voice-Activated Restaurant Assistant")
94
- audio_input = gr.Audio(type="filepath", label="Speak Now")
95
 
96
  output_text = gr.Textbox(label="Transcription")
97
 
 
 
98
  demo.launch()
 
78
  audio_response_path = generate_voice_response(response)
79
  return response, audio_response_path
80
 
 
 
 
 
 
 
81
  def run_assistant(audio):
82
  transcription, audio_response_path = process_audio(audio)
83
  os.system(f"start {audio_response_path}") # Automatically play the response audio
 
85
 
86
  with gr.Blocks() as demo:
87
  gr.Markdown("# Voice-Activated Restaurant Assistant")
88
+ audio_input = gr.Audio(type="filepath", label="Speak Now", streaming=True)
89
 
90
  output_text = gr.Textbox(label="Transcription")
91
 
92
+ audio_input.change(fn=run_assistant, inputs=audio_input, outputs=output_text)
93
+
94
  demo.launch()