Thanh-Lam commited on
Commit
417cdda
·
1 Parent(s): 21d479d

Fix IsADirectoryError: ensure prepared_path is valid file before returning to Gradio Audio output

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -99,6 +99,8 @@ def _diarize_action(
99
  source_name,
100
  str(download_tmp) if download_tmp else "",
101
  ]
 
 
102
  return (
103
  table,
104
  str(rttm_path),
@@ -106,7 +108,7 @@ def _diarize_action(
106
  df_rows,
107
  dict_segments,
108
  audio_state,
109
- str(prepared_path),
110
  )
111
  except Exception as exc: # pragma: no cover - hiển thị lỗi cho người dùng giao diện
112
  empty_state = ["", "", "", ""]
 
99
  source_name,
100
  str(download_tmp) if download_tmp else "",
101
  ]
102
+ # Đảm bảo prepared_path là file path hợp lệ, không phải None hoặc directory
103
+ audio_file_output = str(prepared_path) if prepared_path and Path(prepared_path).is_file() else None
104
  return (
105
  table,
106
  str(rttm_path),
 
108
  df_rows,
109
  dict_segments,
110
  audio_state,
111
+ audio_file_output,
112
  )
113
  except Exception as exc: # pragma: no cover - hiển thị lỗi cho người dùng giao diện
114
  empty_state = ["", "", "", ""]