You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Get the parts of the transcript which were flagged as sensitive
326
+
for result in transcript.content_safety_labels.results:
327
+
print(result.text) # sensitive text snippet
328
+
print(result.timestamp.start)
329
+
print(result.timestamp.end)
330
+
331
+
for label in result.labels:
332
+
print(label.label) # content safety category
333
+
print(label.confidence) # model's confidence that the text is in this category
334
+
print(label.severity) # severity of the text in relation to the category
335
+
336
+
# Get the confidence of the most common labels in relation to the entire audio file
337
+
for label, confidence in transcript.content_safety_labels.summary.items():
338
+
print(f"{confidence *100}% confident that the audio contains {label}")
339
+
340
+
# Get the overall severity of the most common labels in relation to the entire audio file
341
+
for label, severity_confidence in transcript.content_safety_labels.severity_score_summary.items():
342
+
print(f"{severity_confidence.low *100}% confident that the audio contains low-severity {label}")
343
+
print(f"{severity_confidence.medium *100}% confident that the audio contains mid-severity {label}")
344
+
print(f"{severity_confidence.high *100}% confident that the audio contains high-severity {label}")
345
+
346
+
```
347
+
348
+
[Read more about the content safety categories.](https://www.assemblyai.com/docs/Models/content_moderation#all-labels-supported-by-the-model)
349
+
350
+
By default, the content safety model will only include labels with a confidence greater than 0.5 (50%). To change this, pass `content_safety_confidence` (as an integer percentage between 25 and 100, inclusive) to the `TranscriptionConfig`:
351
+
352
+
```python
353
+
config=aai.TranscriptionConfig(
354
+
content_safety=True,
355
+
content_safety_confidence=80, # only include labels with a confidence greater than 80%
0 commit comments