# Talk Link
This a tool to generate a talk link from a youtube video. It uses the AssemblyAI API to transcribe the audio and then assigns speakers to the transcript. It then generates an html page with the transcript and the embedded video. Offers features like searching, filter text based on speaker, and more.

## End to end example
First install the package:
```bash
pip install -e .
```

Then run the example script:
```bash
ASSEMBLYAI_API_KEY=<api key> python example/example.py
```

The example is based on this [video](https://www.youtube.com/watch?v=1emwCJbe9y8). To view it:
```bash
open example/html/1emwCJbe9y8_talklink_output.html
```

## Individual steps
### Download audio
```bash
python talklink/download.py --url "<youtube url>"
```

### Generate a transcript
```bash
ASSEMBLYAI_API_KEY=<api key> python talklink/transcribe.py --file_path "<audio file>" --output_type "<txt or json>" --output_path "<output file>"
```

### Assign speakers
```bash
python talklink/assign_speakers.py --transcript_path <transcript path> --speaker_map_path <speaker map path> --output_path <output path>
```

where the transcript is a `txt` or `json` file generated by the `transcribe.py` script and the speaker map is a json file with the following format:

```json
{
    "A": "Mark",
    "B": "Helly R",
    "C": "Irwin",
    "D": "Dylan"
}
```

### Generate a page
```bash
python talklink/generate_enriched_page.py --input_file_path <transcript path> --video_url <youtube url> --speakers <speakers>
```

### Generate a speaker map
```bash
python talklink/generate_speaker_map.py --output_path <output_folder> "<name1>" "<name2>" 
```

### Assign speakers to a page
```bash
python talklink/assign_speakers_html.py --talklink_page <talklink page> --speaker_map <speaker map>
```