Skip to content

Commit 478a5f0

Browse files
authored
Merge pull request video-db#3 from video-db/update-docs-v-0.0.2
Update docs v 0.0.2
2 parents 57ed37d + e624404 commit 478a5f0

5 files changed

+794
-194
lines changed

examples/aws_rekognition/content_moderation_with_aws.ipynb

+17-66
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"metadata": {},
66
"source": [
77
"## Overview\n",
8+
"---\n",
89
"\n",
910
"<a href=\"https://colab.research.google.com/github/video-db/videodb-cookbook/blob/main/examples/aws_rekognition/content_moderation.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>\n",
1011
"\n",
@@ -22,7 +23,8 @@
2223
"cell_type": "markdown",
2324
"metadata": {},
2425
"source": [
25-
"## Setup"
26+
"## Setup\n",
27+
"---"
2628
]
2729
},
2830
{
@@ -83,36 +85,31 @@
8385
"cell_type": "markdown",
8486
"metadata": {},
8587
"source": [
86-
"## Configuartion\n",
88+
"## ⚙️ Configuartion\n",
8789
"We must set up AWS and the VideoDB api keys."
8890
]
8991
},
9092
{
9193
"cell_type": "markdown",
9294
"metadata": {},
9395
"source": [
94-
"### VideoDB Configuration\n",
96+
"### 🔗 Setting Up a connection to db\n",
9597
"\n",
96-
"We need to setup VideoDB connection, so that we can store our video in VideoDB and then later on clip (*clipping is as simple as a db query with videodb* 😉🤌)\n",
98+
"To connect to `VideoDB`, simply create a `Connection` object.\n",
9799
"\n",
98-
"we need `api_key` to setup a connection (if you haven't already, grab yours from [console.videodb.io](https://console.videodb.io))\n",
100+
"This can be done by either providing your VideoDB API key directly to the constructor or by setting the `VIDEO_DB_API_KEY` environment variable with your API key.\n",
99101
"\n",
100-
"\n"
102+
"> 💡 Your API key is available in the [VideoDB dashboard](https://console.videodb.io)"
101103
]
102104
},
103105
{
104106
"cell_type": "code",
105-
"execution_count": 19,
107+
"execution_count": 1,
106108
"metadata": {},
107109
"outputs": [],
108110
"source": [
109-
"import videodb \n",
110-
"\n",
111-
"VIDEO_DB_API_KEY = os.environ.get(\"VIDEODB_API_KEY\", \"\")\n",
112-
"base_url = \"https://api.videodb.io\"\n",
113-
"\n",
114-
"#Setup up a connection to database\n",
115-
"videodb_conn = videodb.connect(base_url=base_url, api_key=VIDEO_DB_API_KEY)"
111+
"from videodb import connect, play_stream\n",
112+
"conn = connect(api_key=\"\")"
116113
]
117114
},
118115
{
@@ -135,9 +132,9 @@
135132
"source": [
136133
"import boto3\n",
137134
"\n",
138-
"aws_access_key_id= os.environ.get('AWS_KEY_ID', \"\")\n",
139-
"aws_secret_access_key = os.environ.get(\"AWS_KEY_SECRET\", \"\")\n",
140-
"region_name = os.environ.get(\"AWS_REIGON\", \"\")\n",
135+
"aws_access_key_id= \"YOUR_AWS_KEY_ID\"\n",
136+
"aws_secret_access_key = \"YOUR_AWS_SECRET_KEY\" \n",
137+
"region_name = \"YOUR_AWS_REIGON\"\n",
141138
"\n",
142139
"bucket_name = \"videorekog\"\n",
143140
"\n",
@@ -352,55 +349,9 @@
352349
}
353350
],
354351
"source": [
355-
"vid = videodb_conn.upload(url=video_url_yt)\n",
356-
"vid.generate_stream(timeline=shots)\n",
357-
"player_url = vid.play()\n",
358-
"print(player_url)"
359-
]
360-
},
361-
{
362-
"cell_type": "markdown",
363-
"metadata": {},
364-
"source": [
365-
"### Embedding the player in IFrame\n",
366-
"You have the option to incorporate the player within an IFrame by utilizing the following code:"
367-
]
368-
},
369-
{
370-
"cell_type": "code",
371-
"execution_count": 23,
372-
"metadata": {},
373-
"outputs": [
374-
{
375-
"data": {
376-
"text/html": [
377-
"\n",
378-
" <iframe\n",
379-
" width=\"800\"\n",
380-
" height=\"400\"\n",
381-
" src=\"https://console.dev.videodb.io/player?url=https://dseetlpshk2tb.cloudfront.net/v3/published/manifests/9ec3d1e9-499f-488a-b8b2-f2880f35d1a6.m3u8\"\n",
382-
" frameborder=\"0\"\n",
383-
" allowfullscreen\n",
384-
" \n",
385-
" ></iframe>\n",
386-
" "
387-
],
388-
"text/plain": [
389-
"<IPython.lib.display.IFrame at 0x7fb99891b820>"
390-
]
391-
},
392-
"execution_count": 23,
393-
"metadata": {},
394-
"output_type": "execute_result"
395-
}
396-
],
397-
"source": [
398-
"from IPython.display import IFrame \n",
399-
"\n",
400-
"player_width = 800\n",
401-
"player_height = 400\n",
402-
"\n",
403-
"IFrame(player_url, player_width, player_height)"
352+
"video = conn.upload(url=video_url_yt)\n",
353+
"stream_link = video.generate_stream(timeline=shots)\n",
354+
"play_stream(stream_link)"
404355
]
405356
}
406357
],

0 commit comments

Comments
 (0)