{"id":20346640,"url":"https://github.com/arthurfdlr/speech-transcription-and-diarization","last_synced_at":"2026-07-08T04:31:13.967Z","repository":{"id":238955921,"uuid":"798079920","full_name":"ArthurFDLR/speech-transcription-and-diarization","owner":"ArthurFDLR","description":"💬 Combines Whisper and PyAnnote for Automatic Speaker Diarized Speech Recognition","archived":false,"fork":false,"pushed_at":"2024-06-19T17:49:49.000Z","size":30,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-26T02:41:54.767Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ArthurFDLR.png","metadata":{"files":{"readme":"README.ipynb","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-09T03:54:58.000Z","updated_at":"2024-06-19T17:49:53.000Z","dependencies_parsed_at":"2024-11-14T22:13:46.265Z","dependency_job_id":null,"html_url":"https://github.com/ArthurFDLR/speech-transcription-and-diarization","commit_stats":null,"previous_names":["arthurfdlr/speech-transcription-and-diarization"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ArthurFDLR/speech-transcription-and-diarization","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArthurFDLR%2Fspeech-transcription-and-diarization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArthurFDLR%2Fspeech-transcription-and-diarization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArthurFDLR%2Fspeech-transcription-and-diarization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArthurFDLR%2Fspeech-transcription-and-diarization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ArthurFDLR","download_url":"https://codeload.github.com/ArthurFDLR/speech-transcription-and-diarization/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArthurFDLR%2Fspeech-transcription-and-diarization/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35252324,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-08T02:00:06.796Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T22:13:42.292Z","updated_at":"2026-07-08T04:31:13.942Z","avatar_url":"https://github.com/ArthurFDLR.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# Speech Transcription and Diarization\\n\",\n    \"\\n\",\n    \"💬 YoutubeCC - Parse JSON3 Youtube Closed Captions\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 1,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"name\": \"stderr\",\n     \"output_type\": \"stream\",\n     \"text\": [\n      \"/home/arthur/Documents/02.workspace/02.active/speech-transcription-and-diarization/venv/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\\n\",\n      \"  from .autonotebook import tqdm as notebook_tqdm\\n\"\n     ]\n    }\n   ],\n   \"source\": [\n    \"import dotenv, json\\n\",\n    \"from pathlib import Path\\n\",\n    \"from stad import WhisperPipeline, DiarizationPipeline, assign_speaker_to_transcript\\n\",\n    \"\\n\",\n    \"# Load HF_TOKEN from .env file\\n\",\n    \"dotenv.load_dotenv()\\n\",\n    \"\\n\",\n    \"AUDIO_PATH = Path.cwd() / \\\".data\\\" / \\\"audio.wav\\\"\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Automatic Speech Recognition with Hugging Face Transformers implementation of Whisper\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 2,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"name\": \"stderr\",\n     \"output_type\": \"stream\",\n     \"text\": [\n      \"Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.\\n\",\n      \"WhisperModel is using WhisperSdpaAttention, but `torch.nn.functional.scaled_dot_product_attention` does not support `output_attentions=True` or `layer_head_mask` not None. Falling back to the manual attention implementation, but specifying the manual implementation will be required from Transformers version v5.0.0 onwards. This warning can be removed using the argument `attn_implementation=\\\"eager\\\"` when loading the model.\\n\",\n      \"Whisper did not predict an ending timestamp, which can happen if audio is cut off in the middle of a word. Also make sure WhisperTimeStampLogitsProcessor was used during generation.\\n\"\n     ]\n    },\n    {\n     \"data\": {\n      \"text/html\": [\n       \"\u003cdiv\u003e\\n\",\n       \"\u003cstyle scoped\u003e\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"\u003c/style\u003e\\n\",\n       \"\u003ctable border=\\\"1\\\" class=\\\"dataframe\\\"\u003e\\n\",\n       \"  \u003cthead\u003e\\n\",\n       \"    \u003ctr style=\\\"text-align: right;\\\"\u003e\\n\",\n       \"      \u003cth\u003e\u003c/th\u003e\\n\",\n       \"      \u003cth\u003etext\u003c/th\u003e\\n\",\n       \"      \u003cth\u003estart\u003c/th\u003e\\n\",\n       \"      \u003cth\u003eend\u003c/th\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"  \u003c/thead\u003e\\n\",\n       \"  \u003ctbody\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e0\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003eWhat's\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:00.040000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:00.300000\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e1\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003eup\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:00.300000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:00.440000\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e2\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003eeverybody\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:00.440000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:00.700000\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e3\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003ewelcome\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:00.700000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:01\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e4\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003eto\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:01\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:01.220000\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e...\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003e...\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e...\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e...\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e25428\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003eWe'll\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:16.760000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:17.040000\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e25429\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003esee\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:17.040000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:17.160000\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e25430\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003eyou\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:17.160000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:17.300000\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e25431\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003ethere.\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:17.300000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:17.500000\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e25432\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003ePeace.\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:17.500000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:18.320000\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"  \u003c/tbody\u003e\\n\",\n       \"\u003c/table\u003e\\n\",\n       \"\u003cp\u003e25433 rows × 3 columns\u003c/p\u003e\\n\",\n       \"\u003c/div\u003e\"\n      ],\n      \"text/plain\": [\n       \"             text                  start                    end\\n\",\n       \"0          What's 0 days 00:00:00.040000 0 days 00:00:00.300000\\n\",\n       \"1              up 0 days 00:00:00.300000 0 days 00:00:00.440000\\n\",\n       \"2       everybody 0 days 00:00:00.440000 0 days 00:00:00.700000\\n\",\n       \"3         welcome 0 days 00:00:00.700000        0 days 00:00:01\\n\",\n       \"4              to        0 days 00:00:01 0 days 00:00:01.220000\\n\",\n       \"...           ...                    ...                    ...\\n\",\n       \"25428       We'll 0 days 02:03:16.760000 0 days 02:03:17.040000\\n\",\n       \"25429         see 0 days 02:03:17.040000 0 days 02:03:17.160000\\n\",\n       \"25430         you 0 days 02:03:17.160000 0 days 02:03:17.300000\\n\",\n       \"25431      there. 0 days 02:03:17.300000 0 days 02:03:17.500000\\n\",\n       \"25432      Peace. 0 days 02:03:17.500000 0 days 02:03:18.320000\\n\",\n       \"\\n\",\n       \"[25433 rows x 3 columns]\"\n      ]\n     },\n     \"execution_count\": 2,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"with WhisperPipeline.create(\\n\",\n    \"    return_timestamps=\\\"word\\\",\\n\",\n    \"    attn_implementation=\\\"sdpa\\\",\\n\",\n    \"    batch_size=16,\\n\",\n    \") as whisper:\\n\",\n    \"    transcript_df = whisper(\\n\",\n    \"        audio_path=AUDIO_PATH,\\n\",\n    \"        language=\\\"english\\\",\\n\",\n    \"    )\\n\",\n    \"\\n\",\n    \"transcript_df\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Speaker Diarization with PyAnnote [`pyannote/speaker-diarization-3.1`](https://huggingface.co/pyannote/speaker-diarization-3.1)\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 3,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"name\": \"stderr\",\n     \"output_type\": \"stream\",\n     \"text\": [\n      \"torchvision is not available - cannot save figures\\n\"\n     ]\n    },\n    {\n     \"data\": {\n      \"text/html\": [\n       \"\u003cdiv\u003e\\n\",\n       \"\u003cstyle scoped\u003e\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"\u003c/style\u003e\\n\",\n       \"\u003ctable border=\\\"1\\\" class=\\\"dataframe\\\"\u003e\\n\",\n       \"  \u003cthead\u003e\\n\",\n       \"    \u003ctr style=\\\"text-align: right;\\\"\u003e\\n\",\n       \"      \u003cth\u003e\u003c/th\u003e\\n\",\n       \"      \u003cth\u003elabel\u003c/th\u003e\\n\",\n       \"      \u003cth\u003espeaker\u003c/th\u003e\\n\",\n       \"      \u003cth\u003estart\u003c/th\u003e\\n\",\n       \"      \u003cth\u003eend\u003c/th\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"  \u003c/thead\u003e\\n\",\n       \"  \u003ctbody\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e0\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003eA\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003eSPEAKER_03\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:00.132218750\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:46.319093750\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e1\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003eB\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003eSPEAKER_02\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:24.870968750\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:25.124093750\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e2\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003eC\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003eSPEAKER_03\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:47.567843750\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:58.705343750\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e3\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003eD\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003eSPEAKER_04\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:56.376593750\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:57.540968750\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e4\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003eE\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003eSPEAKER_03\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:59.430968750\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:01:04.206593750\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e...\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003e...\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e...\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e...\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e...\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e3208\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003eDSK\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003eSPEAKER_03\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:08.597843750\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:09.272843750\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e3209\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003eDSL\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003eSPEAKER_03\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:10.049093750\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:11.669093750\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e3210\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003eDSM\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003eSPEAKER_00\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:11.669093750\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:11.702843750\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e3211\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003eDSN\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003eSPEAKER_00\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:15.145343750\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:17.541593750\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e3212\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003eDSO\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003eSPEAKER_00\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:17.963468750\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:18.300968750\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"  \u003c/tbody\u003e\\n\",\n       \"\u003c/table\u003e\\n\",\n       \"\u003cp\u003e3213 rows × 4 columns\u003c/p\u003e\\n\",\n       \"\u003c/div\u003e\"\n      ],\n      \"text/plain\": [\n       \"     label     speaker                     start                       end\\n\",\n       \"0        A  SPEAKER_03 0 days 00:00:00.132218750 0 days 00:00:46.319093750\\n\",\n       \"1        B  SPEAKER_02 0 days 00:00:24.870968750 0 days 00:00:25.124093750\\n\",\n       \"2        C  SPEAKER_03 0 days 00:00:47.567843750 0 days 00:00:58.705343750\\n\",\n       \"3        D  SPEAKER_04 0 days 00:00:56.376593750 0 days 00:00:57.540968750\\n\",\n       \"4        E  SPEAKER_03 0 days 00:00:59.430968750 0 days 00:01:04.206593750\\n\",\n       \"...    ...         ...                       ...                       ...\\n\",\n       \"3208   DSK  SPEAKER_03 0 days 02:03:08.597843750 0 days 02:03:09.272843750\\n\",\n       \"3209   DSL  SPEAKER_03 0 days 02:03:10.049093750 0 days 02:03:11.669093750\\n\",\n       \"3210   DSM  SPEAKER_00 0 days 02:03:11.669093750 0 days 02:03:11.702843750\\n\",\n       \"3211   DSN  SPEAKER_00 0 days 02:03:15.145343750 0 days 02:03:17.541593750\\n\",\n       \"3212   DSO  SPEAKER_00 0 days 02:03:17.963468750 0 days 02:03:18.300968750\\n\",\n       \"\\n\",\n       \"[3213 rows x 4 columns]\"\n      ]\n     },\n     \"execution_count\": 3,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"with DiarizationPipeline() as diarization:\\n\",\n    \"    speakers_df = diarization(audio_path=AUDIO_PATH)\\n\",\n    \"\\n\",\n    \"speakers_df\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Assign speaker labels to each chunk in the transcript\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 4,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"\u003cdiv\u003e\\n\",\n       \"\u003cstyle scoped\u003e\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"\u003c/style\u003e\\n\",\n       \"\u003ctable border=\\\"1\\\" class=\\\"dataframe\\\"\u003e\\n\",\n       \"  \u003cthead\u003e\\n\",\n       \"    \u003ctr style=\\\"text-align: right;\\\"\u003e\\n\",\n       \"      \u003cth\u003e\u003c/th\u003e\\n\",\n       \"      \u003cth\u003etext\u003c/th\u003e\\n\",\n       \"      \u003cth\u003estart\u003c/th\u003e\\n\",\n       \"      \u003cth\u003eend\u003c/th\u003e\\n\",\n       \"      \u003cth\u003espeaker\u003c/th\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"  \u003c/thead\u003e\\n\",\n       \"  \u003ctbody\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e0\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003eWhat's\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:00.040000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:00.300000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003eSPEAKER_03\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e1\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003eup\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:00.300000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:00.440000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003eSPEAKER_03\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e2\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003eeverybody\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:00.440000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:00.700000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003eSPEAKER_03\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e3\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003ewelcome\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:00.700000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:01\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003eSPEAKER_03\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e4\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003eto\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:01\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 00:00:01.220000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003eSPEAKER_03\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e...\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003e...\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e...\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e...\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e...\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e25428\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003eWe'll\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:16.760000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:17.040000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003eSPEAKER_03\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e25429\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003esee\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:17.040000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:17.160000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003eSPEAKER_00\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e25430\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003eyou\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:17.160000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:17.300000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003eSPEAKER_03\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e25431\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003ethere.\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:17.300000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:17.500000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003eSPEAKER_00\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"    \u003ctr\u003e\\n\",\n       \"      \u003cth\u003e25432\u003c/th\u003e\\n\",\n       \"      \u003ctd\u003ePeace.\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:17.500000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003e0 days 02:03:18.320000\u003c/td\u003e\\n\",\n       \"      \u003ctd\u003eSPEAKER_03\u003c/td\u003e\\n\",\n       \"    \u003c/tr\u003e\\n\",\n       \"  \u003c/tbody\u003e\\n\",\n       \"\u003c/table\u003e\\n\",\n       \"\u003cp\u003e25433 rows × 4 columns\u003c/p\u003e\\n\",\n       \"\u003c/div\u003e\"\n      ],\n      \"text/plain\": [\n       \"             text                  start                    end     speaker\\n\",\n       \"0          What's 0 days 00:00:00.040000 0 days 00:00:00.300000  SPEAKER_03\\n\",\n       \"1              up 0 days 00:00:00.300000 0 days 00:00:00.440000  SPEAKER_03\\n\",\n       \"2       everybody 0 days 00:00:00.440000 0 days 00:00:00.700000  SPEAKER_03\\n\",\n       \"3         welcome 0 days 00:00:00.700000        0 days 00:00:01  SPEAKER_03\\n\",\n       \"4              to        0 days 00:00:01 0 days 00:00:01.220000  SPEAKER_03\\n\",\n       \"...           ...                    ...                    ...         ...\\n\",\n       \"25428       We'll 0 days 02:03:16.760000 0 days 02:03:17.040000  SPEAKER_03\\n\",\n       \"25429         see 0 days 02:03:17.040000 0 days 02:03:17.160000  SPEAKER_00\\n\",\n       \"25430         you 0 days 02:03:17.160000 0 days 02:03:17.300000  SPEAKER_03\\n\",\n       \"25431      there. 0 days 02:03:17.300000 0 days 02:03:17.500000  SPEAKER_00\\n\",\n       \"25432      Peace. 0 days 02:03:17.500000 0 days 02:03:18.320000  SPEAKER_03\\n\",\n       \"\\n\",\n       \"[25433 rows x 4 columns]\"\n      ]\n     },\n     \"execution_count\": 4,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"assign_speaker_to_transcript(\\n\",\n    \"    speakers_df=speakers_df,\\n\",\n    \"    transcript_df=transcript_df,\\n\",\n    \"    inplace=True,\\n\",\n    \")\\n\",\n    \"\\n\",\n    \"transcript_df.to_json(\\n\",\n    \"    AUDIO_PATH.with_suffix(\\\".json\\\"), orient=\\\"records\\\", indent=4\\n\",\n    \")\\n\",\n    \"\\n\",\n    \"transcript_df\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": []\n  }\n ],\n \"metadata\": {\n  \"kernelspec\": {\n   \"display_name\": \"venv\",\n   \"language\": \"python\",\n   \"name\": \"python3\"\n  },\n  \"language_info\": {\n   \"codemirror_mode\": {\n    \"name\": \"ipython\",\n    \"version\": 3\n   },\n   \"file_extension\": \".py\",\n   \"mimetype\": \"text/x-python\",\n   \"name\": \"python\",\n   \"nbconvert_exporter\": \"python\",\n   \"pygments_lexer\": \"ipython3\",\n   \"version\": \"3.10.9\"\n  }\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 2\n}\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farthurfdlr%2Fspeech-transcription-and-diarization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farthurfdlr%2Fspeech-transcription-and-diarization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farthurfdlr%2Fspeech-transcription-and-diarization/lists"}