Skip to content

Commit 6d4300f

Browse files
authored
Merge pull request #50 from slashml/video-pipeline
add youtube video transcription example
2 parents e17c57b + 00012bf commit 6d4300f

File tree

12 files changed

+95
-0
lines changed

12 files changed

+95
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
examples/*/data/*
12
__pycache__
23
*.egg-info/
34

examples/deploy_model/hugging_face_transformer/deploy_hugging_face_transformer.py renamed to examples/deploy_custom_models/hugging_face_transformer/deploy_hugging_face_transformer.py

File renamed without changes.

examples/deploy_model/hugging_face_transformer/requirements.txt renamed to examples/deploy_custom_models/hugging_face_transformer/requirements.txt

File renamed without changes.

examples/deploy_model/pytorch/deploy_pytorch_models.py renamed to examples/deploy_custom_models/pytorch/deploy_pytorch_models.py

File renamed without changes.
File renamed without changes.

examples/deploy_model/scikit-learn/deploy_scikit_learn_models.py renamed to examples/deploy_custom_models/scikit-learn/deploy_scikit_learn_models.py

File renamed without changes.

examples/deploy_model/scikit-learn/requirements.txt renamed to examples/deploy_custom_models/scikit-learn/requirements.txt

File renamed without changes.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
## Setup
3+
Create a new python virtual env and install the requirements:
4+
5+
```bash
6+
python3 -m venv venv
7+
source venv/bin/activate
8+
pip install -r requirements.txt
9+
```
10+
11+
## Transcribing a single video
12+
update the `youtube_url` variable at line 36 in `youtube_video_transcription.py` with the url of the video you want to transcribe.
13+
14+
Run the script:
15+
16+
```bash
17+
python3 transcribe_youtube_video.py
18+
```
19+
The result should contain the transcription of the video.
20+
21+
## Multiple Videos
22+
For transcribing a list of videos, update the `youtube_urls` variable at line 8 in `youtube_video_transcription.py` with the list of urls of the videos you want to transcribe.
23+
24+
Then execute the script:
25+
26+
```bash
27+
python transcribe_multiple_youtube_videos.py
28+
```
29+
30+
This will print a list of transcription texts.
31+
32+
33+
For more information, read our docs at https://docs.slashml.com/reference/service/speech_to_text.html
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
youtube-dl@git+https://github.com/ytdl-org/youtube-dl.git
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from transcribe_youtube_video import transcribe_youtube_file
2+
3+
def transcribe_multiple_youtube_videos(*, youtube_urls:list):
4+
return list(map(transcribe_youtube_file, youtube_urls))
5+
6+
7+
if __name__=="__main__":
8+
youtube_urls = ['https://youtu.be/5-TgqZ8nado','https://youtu.be/5-TgqZ8nado']
9+
10+
list_of_transcriptions = transcribe_multiple_youtube_videos(youtube_urls=youtube_url)
11+
12+
from pprint import pprint as pp
13+
pp(list_of_transcriptions)

0 commit comments

Comments
 (0)