Skip to content

Commit

Permalink
[cli] remove output_file para for the diarization task
Browse files Browse the repository at this point in the history
  • Loading branch information
JiJiJiang committed Nov 10, 2023
1 parent fa5f70b commit cb92e31
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pip install git+https://github.com/wenet-e2e/wespeaker.git
``` sh
$ wespeaker --task embedding --audio_file audio.wav --output_file embedding.txt
$ wespeaker --task similarity --audio_file audio.wav --audio_file2 audio2.wav
$ wespeaker --task diarization --audio_file audio.wav --output_file diarization.txt # TODO
$ wespeaker --task diarization --audio_file audio.wav # TODO
```

**Python programming usage**:
Expand Down
4 changes: 2 additions & 2 deletions docs/python_package.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pip install -e .
``` sh
$ wespeaker --task embedding --audio_file audio.wav --output_file embedding.txt
$ wespeaker --task similarity --audio_file audio.wav --audio_file2 audio2.wav
$ wespeaker --task diarization --audio_file audio.wav --output_file diarization.txt # TODO
$ wespeaker --task diarization --audio_file audio.wav # TODO
```

You can specify the following parameters. (use `-h` for details)
Expand All @@ -34,7 +34,7 @@ You can specify the following parameters. (use `-h` for details)
* `--audio_file2`: input audio file2 path, spicifically for the similarity task
* `--resample_rate`: resample rate (default: 16000)
* `--vad`: apply vad or not for the input audios (default: true)
* `--output_file`: output file to save speaker embedding or diarization result
* `--output_file`: output file to save speaker embedding

## Python Programming Usage

Expand Down
11 changes: 4 additions & 7 deletions wespeaker/cli/speaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,8 @@ def get_args():
parser.add_argument('--vad',
action='store_true',
help='whether to do VAD or not')
parser.add_argument(
'--output_file',
help='output file to save speaker embedding or diarization result')
parser.add_argument('--output_file',
help='output file to save speaker embedding')
args = parser.parse_args()
return args

Expand All @@ -166,10 +165,8 @@ def main():
elif args.task == 'diarization':
# TODO(Chengdong Liang): Add diarization surport
diar_result = model.diarize(args.audio_file)
with open(args.output_file, "w") as fout:
for (start, end, spkid) in diar_result:
fout.write("{:.3f}\t{:.3f}\t{:d}\n".format(start, end, spkid))
print('Succeed, see {}'.format(args.output_file))
for (start, end, spkid) in diar_result:
print("{:.3f}\t{:.3f}\t{:d}".format(start, end, spkid))
else:
print('Unsupported task {}'.format(args.task))
sys.exit(-1)
Expand Down

0 comments on commit cb92e31

Please sign in to comment.