fixed #49, fixed #52

This commit is contained in:
2019-03-08 11:35:05 -05:00
parent 9952f5fe4b
commit 82efb77ff2
3 changed files with 6311 additions and 3 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -90,15 +90,22 @@ def status(job_name):
@cli.command() @cli.command()
@click.option('--punctuation', is_flag=True, default=True, @click.option('--punctuation', is_flag=True, default=True,
help='only for Google Speech, defaults to True') help='only for Google Speech, defaults to True')
@click.option('--speaker-id', is_flag=True, default=True, @click.option('--speaker-id/--no-speaker-id', is_flag=True, default=True,
help='only for Google Speech, defaults to True') help='only for google and amazon, defaults to True')
@click.option('--num_speakers', default=2, type=int,
help='only for google and amazon, defaults to 2')
@click.option('--model', default='phone_call', @click.option('--model', default='phone_call',
help='only for Google Speech, defaults to "phone_call"') help='only for Google Speech, defaults to "phone_call"')
@click.option('--use-enhanced', is_flag=True, default=True, @click.option('--use-enhanced', is_flag=True, default=True,
help='only for Google Speech, defaults to True') help='only for Google Speech, defaults to True')
@click.argument('media_filepath', type=str) @click.argument('media_filepath', type=str)
@click.argument('service_name', type=str) @click.argument('service_name', type=str)
def this(media_filepath, service_name, punctuation, speaker_id, model, def this(media_filepath,
service_name,
punctuation,
speaker_id,
num_speakers,
model,
use_enhanced): use_enhanced):
"""Sends a media file to be transcribed.""" """Sends a media file to be transcribed."""
if service_name == 'google': if service_name == 'google':
@@ -107,7 +114,13 @@ def this(media_filepath, service_name, punctuation, speaker_id, model,
enable_speaker_diarization=speaker_id, enable_speaker_diarization=speaker_id,
model=model, model=model,
use_enhanced=use_enhanced, use_enhanced=use_enhanced,
num_speakers=num_speakers,
) )
elif service_name == 'amazon':
transcribe_kwargs = dict(
enable_speaker_diarization=speaker_id,
num_speakers=num_speakers,
)
else: else:
transcribe_kwargs = {} transcribe_kwargs = {}
try: try:

View File

@@ -100,6 +100,7 @@ class Transcriber(TranscriberBaseClass):
language_code='en-US', language_code='en-US',
enable_automatic_punctuation=True, enable_automatic_punctuation=True,
enable_speaker_diarization=True, enable_speaker_diarization=True,
num_speakers=2,
model='phone_call', model='phone_call',
use_enhanced=True, use_enhanced=True,
) -> str: ) -> str:
@@ -124,6 +125,7 @@ class Transcriber(TranscriberBaseClass):
language_code=language_code, language_code=language_code,
enable_automatic_punctuation=enable_automatic_punctuation, enable_automatic_punctuation=enable_automatic_punctuation,
enable_speaker_diarization=enable_speaker_diarization, enable_speaker_diarization=enable_speaker_diarization,
diarization_speaker_count=num_speakers,
model=model, model=model,
use_enhanced=use_enhanced, use_enhanced=use_enhanced,
) )