terry-li-hm commited on
Commit
b0de40b
·
1 Parent(s): 666f662
Files changed (1) hide show
  1. sv.py +4 -25
sv.py CHANGED
@@ -220,32 +220,11 @@ def generate_diarization(audio_path):
220
  if torch.cuda.is_available():
221
  pipeline.to(torch.device("cuda"))
222
 
223
- # Set the correct path for the audio file
224
- script_dir = os.path.dirname(os.path.abspath(__file__))
225
- possible_paths = [
226
- os.path.join(script_dir, "example", "mtr.mp3"),
227
- os.path.join(script_dir, "..", "example", "mtr.mp3"),
228
- os.path.join(script_dir, "mtr.mp3"),
229
- "mtr.mp3",
230
- audio_path, # Add the provided audio_path to the list of possible paths
231
- ]
232
 
233
- file_path = None
234
- for path in possible_paths:
235
- if os.path.exists(path):
236
- file_path = path
237
- break
238
-
239
- if file_path is None:
240
- print("Debugging information:")
241
- print(f"Current working directory: {os.getcwd()}")
242
- print(f"Script directory: {script_dir}")
243
- print("Attempted paths:")
244
- for path in possible_paths:
245
- print(f" {path}")
246
- raise FileNotFoundError(
247
- "Could not find the audio file. Please ensure it's in the correct location."
248
- )
249
 
250
  print(f"Using audio file: {file_path}")
251
 
 
220
  if torch.cuda.is_available():
221
  pipeline.to(torch.device("cuda"))
222
 
223
+ # Use only the provided audio_path
224
+ file_path = audio_path
 
 
 
 
 
 
 
225
 
226
+ if not os.path.exists(file_path):
227
+ raise FileNotFoundError(f"Could not find the audio file at: {file_path}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
 
229
  print(f"Using audio file: {file_path}")
230