Skip to content

Commit 1160659

Browse files
Hristo Stoychevkirillatrev
authored andcommitted
Add support for diarization_type, speakers_count, remove_atmospherics
1 parent e46f5cf commit 1160659

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/rev_ai/apiclient.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def submit_job_url(
7171
skip_postprocessing=False,
7272
remove_atmospherics=False,
7373
speakers_count=None,
74+
diarization_type=None,
7475
summarization_config: SummarizationOptions = None,
7576
translation_config: TranslationOptions = None):
7677
"""Submit media given a URL for transcription.
@@ -124,6 +125,7 @@ def submit_job_url(
124125
:param speakers_count: Use to specify the total number of unique speakers in the audio.
125126
:param summarization_config: Use to request transcript summary.
126127
:param translation_config: Use to request transcript translation.
128+
:param diarization_type: Use to specify diarization type.
127129
:returns: raw response data
128130
:raises: HTTPError
129131
"""
@@ -137,6 +139,10 @@ def submit_job_url(
137139
segments_to_transcribe, speaker_names,
138140
source_config, notification_config,
139141
skip_postprocessing,
142+
remove_atmospherics,
143+
speakers_count,
144+
diarization_type,
145+
skip_postprocessing,
140146
summarization_config=summarization_config,
141147
translation_config=translation_config)
142148

@@ -172,6 +178,7 @@ def submit_job_local_file(
172178
skip_postprocessing=False,
173179
remove_atmospherics=False,
174180
speakers_count=None,
181+
diarization_type=None,
175182
summarization_config: SummarizationOptions = None,
176183
translation_config: TranslationOptions = None):
177184
"""Submit a local file for transcription.
@@ -220,6 +227,7 @@ def submit_job_local_file(
220227
:param remove_atmospherics: Atmospherics such as <laugh>, <affirmative>, etc. will not
221228
appear in the transcript.
222229
:param speakers_count: Use to specify the total number of unique speakers in the audio.
230+
:param diarization_type: Use to specify diarization type.
223231
:param summarization_config: Use to request transcript summary.
224232
:param translation_config: Use to request transcript translation.
225233
:returns: raw response data
@@ -237,6 +245,8 @@ def submit_job_local_file(
237245
verbatim, rush, test_mode,
238246
segments_to_transcribe, speaker_names, None,
239247
notification_config, skip_postprocessing,
248+
remove_atmospherics, speakers_count,
249+
diarization_type,
240250
summarization_config=summarization_config,
241251
translation_config=translation_config)
242252

@@ -714,6 +724,7 @@ def _create_job_options_payload(
714724
skip_postprocessing=False,
715725
remove_atmospherics=None,
716726
speakers_count=None,
727+
diarization_type=None,
717728
summarization_config: SummarizationOptions = None,
718729
translation_config: TranslationOptions = None):
719730
payload = {}
@@ -764,6 +775,8 @@ def _create_job_options_payload(
764775
payload['remove_atmospherics'] = remove_atmospherics
765776
if speakers_count:
766777
payload['speakers_count'] = speakers_count
778+
if diarization_type:
779+
payload['diarization_type'] = diarization_type
767780
if summarization_config:
768781
payload['summarization_config'] = summarization_config.to_dict()
769782
if translation_config:

src/rev_ai/models/asynchronous/job.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def __init__(
3030
segments_to_transcribe=None,
3131
remove_atmospherics=None,
3232
speakers_count=None,
33+
diarization_type=None,
3334
summarization: Summarization = None,
3435
translation: Translation = None):
3536
"""
@@ -62,6 +63,7 @@ def __init__(
6263
:param remove_atmospherics: Atmospherics such as <laugh>, <affirmative>, etc. will noT
6364
appear in the transcript.
6465
:param speakers_count: Use to specify the total number of unique speakers in the audio.
66+
:param diarization_type: Use to specify diarization type.
6567
"""
6668
self.id = id_
6769
self.created_on = created_on
@@ -88,6 +90,7 @@ def __init__(
8890
self.segments_to_transcribe = segments_to_transcribe
8991
self.remove_atmospherics = remove_atmospherics
9092
self.speakers_count = speakers_count
93+
self.diarization_type = diarization_type
9194
self.summarization = summarization
9295
self.translation = translation
9396

@@ -126,6 +129,7 @@ def from_json(cls, json):
126129
segments_to_transcribe=json.get('segments_to_transcribe'),
127130
remove_atmospherics=json.get('remove_atmospherics'),
128131
speakers_count=json.get('speakers_count'),
132+
diarization_type=json.get('diarization_type'),
129133
summarization=Summarization.from_json(json.get('summarization')),
130134
translation=Translation.from_json(json.get('translation'))
131135
)

0 commit comments

Comments
 (0)