art-manuh commited on
Commit
fc2b862
·
verified ·
1 Parent(s): 6c8bda0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -81,8 +81,10 @@ wake_word = "hello"
81
  def assistant(audio):
82
  # Check if the audio file path is provided
83
  print(f"Audio file received: {audio}")
84
-
85
- if audio is None:
 
 
86
  return "No audio provided.", None
87
 
88
  # Convert to WAV format before processing
@@ -104,4 +106,4 @@ gr.Interface(
104
  inputs=gr.Audio(type="filepath"), # Audio input, expecting a file path from the microphone
105
  outputs=[gr.Textbox(), gr.Audio(type="filepath", label="Response Audio")], # Outputs text and the response audio
106
  title="Sema Voice Assistant"
107
- ).launch()
 
81
  def assistant(audio):
82
  # Check if the audio file path is provided
83
  print(f"Audio file received: {audio}")
84
+
85
+ # Check if the file exists before processing
86
+ if not audio or not os.path.exists(audio):
87
+ print(f"Audio file does not exist or is not provided: {audio}")
88
  return "No audio provided.", None
89
 
90
  # Convert to WAV format before processing
 
106
  inputs=gr.Audio(type="filepath"), # Audio input, expecting a file path from the microphone
107
  outputs=[gr.Textbox(), gr.Audio(type="filepath", label="Response Audio")], # Outputs text and the response audio
108
  title="Sema Voice Assistant"
109
+ ).launch(share=True)