Skip to content

Instantly share code, notes, and snippets.

@janlukasschroeder
Created May 10, 2023 20:59
Show Gist options
  • Save janlukasschroeder/ff3cb7a769afb8d3dcfc038da4292cc6 to your computer and use it in GitHub Desktop.
Save janlukasschroeder/ff3cb7a769afb8d3dcfc038da4292cc6 to your computer and use it in GitHub Desktop.
YouTube-Summarizer.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"authorship_tag": "ABX9TyOsTZw5RaD0tpdHvTcPSKgt",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/janlukasschroeder/ff3cb7a769afb8d3dcfc038da4292cc6/youtube-summarizer.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"source": [
"# Summarize YouTube Videos with ChatGPT\n",
"\n",
"Simply set your OpenAI API key and copy the YouTube video ID into the following two cells, hit run, and your YouTube video will automatically be transcribed and summarized with OpenAI ChatGPT."
],
"metadata": {
"id": "NPuM0EOdbL4Y"
}
},
{
"cell_type": "code",
"source": [
"OPENAI_API_KEY = 'YOUR_API_KEY'"
],
"metadata": {
"id": "-AsoVT3var3I"
},
"execution_count": 43,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# https://www.youtube.com/watch?v=cNfINi5CNbY\n",
"# ^---------^\n",
"# ,------------'\n",
"YOUTUBE_VIDEO_ID = 'cNfINi5CNbY'"
],
"metadata": {
"id": "GuREqyKuavFL"
},
"execution_count": 44,
"outputs": []
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {
"id": "1gigrBqlTjqu"
},
"outputs": [],
"source": [
"!pip install -q youtube-transcript-api"
]
},
{
"cell_type": "code",
"source": [
"from youtube_transcript_api import YouTubeTranscriptApi\n",
"\n",
"transcript = YouTubeTranscriptApi.get_transcript(YOUTUBE_VIDEO_ID)"
],
"metadata": {
"id": "QdBXImAYTtG8"
},
"execution_count": 46,
"outputs": []
},
{
"cell_type": "code",
"source": [
"import pandas as pd \n",
"\n",
"transcript = pd.json_normalize(transcript)"
],
"metadata": {
"id": "LnvGOSvfT05-"
},
"execution_count": 47,
"outputs": []
},
{
"cell_type": "code",
"source": [
"transcript"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 424
},
"id": "MmQhujUHT7kY",
"outputId": "9af8ae68-0205-472b-c1bf-3c167f4971b5"
},
"execution_count": 48,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" text start duration\n",
"0 Google I/O '23. 853.687 67.634\n",
"1 Google I/O '23. 1090.957 53.654\n",
"2 Google I/O '23. 1332.832 35.069\n",
"3 Google I/O '23. 1572.839 114.047\n",
"4 Google I/O '23. 1704.804 23.858\n",
"... ... ... ...\n",
"4469 Five. 12921.590 6.540\n",
"4470 Four. 12928.030 1.101\n",
"4471 Three. 12928.230 4.805\n",
"4472 Two. 12929.231 3.904\n",
"4473 On 12933.135 0.000\n",
"\n",
"[4474 rows x 3 columns]"
],
"text/html": [
"\n",
" <div id=\"df-94087eff-2cd8-4952-a8b3-d5efa43b6e96\">\n",
" <div class=\"colab-df-container\">\n",
" <div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>text</th>\n",
" <th>start</th>\n",
" <th>duration</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Google I/O '23.</td>\n",
" <td>853.687</td>\n",
" <td>67.634</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Google I/O '23.</td>\n",
" <td>1090.957</td>\n",
" <td>53.654</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Google I/O '23.</td>\n",
" <td>1332.832</td>\n",
" <td>35.069</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Google I/O '23.</td>\n",
" <td>1572.839</td>\n",
" <td>114.047</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Google I/O '23.</td>\n",
" <td>1704.804</td>\n",
" <td>23.858</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4469</th>\n",
" <td>Five.</td>\n",
" <td>12921.590</td>\n",
" <td>6.540</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4470</th>\n",
" <td>Four.</td>\n",
" <td>12928.030</td>\n",
" <td>1.101</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4471</th>\n",
" <td>Three.</td>\n",
" <td>12928.230</td>\n",
" <td>4.805</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4472</th>\n",
" <td>Two.</td>\n",
" <td>12929.231</td>\n",
" <td>3.904</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4473</th>\n",
" <td>On</td>\n",
" <td>12933.135</td>\n",
" <td>0.000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>4474 rows × 3 columns</p>\n",
"</div>\n",
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-94087eff-2cd8-4952-a8b3-d5efa43b6e96')\"\n",
" title=\"Convert this dataframe to an interactive table.\"\n",
" style=\"display:none;\">\n",
" \n",
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
" width=\"24px\">\n",
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
" </svg>\n",
" </button>\n",
" \n",
" <style>\n",
" .colab-df-container {\n",
" display:flex;\n",
" flex-wrap:wrap;\n",
" gap: 12px;\n",
" }\n",
"\n",
" .colab-df-convert {\n",
" background-color: #E8F0FE;\n",
" border: none;\n",
" border-radius: 50%;\n",
" cursor: pointer;\n",
" display: none;\n",
" fill: #1967D2;\n",
" height: 32px;\n",
" padding: 0 0 0 0;\n",
" width: 32px;\n",
" }\n",
"\n",
" .colab-df-convert:hover {\n",
" background-color: #E2EBFA;\n",
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
" fill: #174EA6;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert {\n",
" background-color: #3B4455;\n",
" fill: #D2E3FC;\n",
" }\n",
"\n",
" [theme=dark] .colab-df-convert:hover {\n",
" background-color: #434B5C;\n",
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
" fill: #FFFFFF;\n",
" }\n",
" </style>\n",
"\n",
" <script>\n",
" const buttonEl =\n",
" document.querySelector('#df-94087eff-2cd8-4952-a8b3-d5efa43b6e96 button.colab-df-convert');\n",
" buttonEl.style.display =\n",
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
"\n",
" async function convertToInteractive(key) {\n",
" const element = document.querySelector('#df-94087eff-2cd8-4952-a8b3-d5efa43b6e96');\n",
" const dataTable =\n",
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
" [key], {});\n",
" if (!dataTable) return;\n",
"\n",
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
" + ' to learn more about interactive tables.';\n",
" element.innerHTML = '';\n",
" dataTable['output_type'] = 'display_data';\n",
" await google.colab.output.renderOutput(dataTable, element);\n",
" const docLink = document.createElement('div');\n",
" docLink.innerHTML = docLinkHtml;\n",
" element.appendChild(docLink);\n",
" }\n",
" </script>\n",
" </div>\n",
" </div>\n",
" "
]
},
"metadata": {},
"execution_count": 48
}
]
},
{
"cell_type": "code",
"source": [
"text = ' '.join(transcript['text'].astype(str))"
],
"metadata": {
"id": "Mh__V5nxUCDv"
},
"execution_count": 49,
"outputs": []
},
{
"cell_type": "code",
"source": [
"from IPython.core.display import display, HTML\n",
"\n",
"def pprint(text):\n",
" display(HTML(text))"
],
"metadata": {
"id": "BuhGcF-kceVU"
},
"execution_count": 65,
"outputs": []
},
{
"cell_type": "code",
"source": [
"text[:5000]"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 164
},
"id": "YcfaU7KVUWJE",
"outputId": "5b8a9ab1-ed02-4071-ca85-9f034f6898e3"
},
"execution_count": 50,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'Google I/O \\'23. Google I/O \\'23. Google I/O \\'23. Google I/O \\'23. Google I/O \\'23. Google I/O \\'23. Google I/O \\'23 Google I/O \\'23 Google I/O \\'23 Google I/O \\'23 Google I/O \\'23 Google I/O \\'23 [Cheers and Applause]. >> Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello. Hello, everyone, my name is Dan deacon. Thanks for coming here early. It\\'s a real pleasure to be sharing the stage with some of my all-time favorites, G-mail and Google Calendar. So we\\'re going to -- I\\'m going to play some songs, and a lot of the content is going to be made using Fanake and Bard and Music LM, so I\\'m just going to get started. This first one is a song of mine called \"when I was done dying kwo,\" and the video was generated thanks to the lyrics of this song. Thanks so much. When I was done dying, my conscience regained So I began my struggle, a nothingness strained Out a flash made of time, my new form blasted out And it startled me so and I burst out a shout My legs ran frantic like birds from a nest And I ran until drained, leaving no choice but rest So I fell asleep softly at the edge of a cave But I should have gone deeper but I\\'m not so brave And like that I was torn out and thrown in the sky And I said all my prayers because surely I\\'ll die As I crashed down and smashed into earth, into dirt How my skin did explode, leaving only my shirt But from shirt grew a tree and then tree grew a fruit And I became the seed and that seed was a brute And I clawed through the ground with my roots and my leaves Tore up the shirt and I ate up the sleeves And they laughed out at me and said \"what is your plan?\" But their question was foreign, I could not understand When then suddenly I\\'m ripped up Placed in a mouth And it swallowed me down at which time I head south No need to fear them, no reason to run. Reached out to touch them faded too soon yet their mouth still remained standing up towards the moon And I looked up beyond that beautiful sky, and I Oh, it greeted me kindly and then we all drank And we drooled out together right onto the ground And the ocean grew quickly right up all around And the earth looked at me and said \"Wasn\\'t that fun?\" And I replied \"I\\'m sorry if I hurt anyone\" And without even thinking cast me into space But before she did that she wiped off my own face She said better luck next time don\\'t worry so much Without ears I couldn\\'t hear I could just feel the touch As I fell asleep softly at the edge of a cave But I should have gone deeper but I\\'m not so brave >> Thank you very much. [Cheers and Applause]. Whew! All right. Now that all the morsh pits hav subsided, we can return to our seats. Let\\'s get center, and where we are in the present, in the now, and I do a lot of shows like this. Normally, they\\'re at night in the dark, and unseated rooms, so I thought maybe we could just all try to do a guided visualization so we can all get in the same place. I\\'m sure a lot of you traveled here today. So let\\'s just fully relax our shoulders, feel our bodies in the seats, our feet on the floor. I used Bard, and I was like how can I structure a guided visualization? For this event. They gave me some suggestions. So let\\'s envision now that we\\'re slowly, slowly lifting up from our seats, floating into the a\\nr air, and let\\'s imagine the air is not really cold. Let\\'s imagine the air is a wonderful, wonderful temperature. We\\'re floating here above the shoreline afAmpitheater. We see everyone else below. They\\'re floating up with us. We\\'re becoming mist. Vapor. And there, we see a beautiful, beautiful entity come towards us. And what is it? It\\'s a bird. A bird with lips. Don\\'t pay too much attention to the lips, but the bird has lips. And the bird says to you, hey, I just got a two-bedroom apartment. I\\'m looking for a roommate. And you think, wow. I never thought about relocating, but what neighborhood is it in? And the bird says, it\\'s in this neighborhood that you\\'ve always wanted to live in. You say that sounds great. Do you live with anybody else? And you\\'re like, yes, I do love playing board games. I have friends over. We play board games. Great. Maybe my friends can become your friends and we\\'ll start a whole community. The bird\\'s like, great, the only thing is it\\'s kind of a small kitchen, so I don\\'t like that many kitchen appliances. And you\\'re like, that\\'s wonderful. I normally eat out, but I\\'m trying to cook more at home. They\\'re like, that\\'s wonderful. We can make meals together. So now that we\\'re all on the same page, we\\'re recentered here, let\\'s just think of how wonderful the world would be if there was a bird with flips that invited us to make meals with them, and we could make wonderful, wonderful meals together. And that\\'s sort of what this whole process has felt like. It\\'s like being a bird and finding a new roommate and mak'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 50
}
]
},
{
"cell_type": "code",
"source": [
"!pip install -q --upgrade tiktoken"
],
"metadata": {
"id": "eBOWhfxQUWq5"
},
"execution_count": 51,
"outputs": []
},
{
"cell_type": "code",
"source": [
"import tiktoken\n",
"\n",
"encoding = tiktoken.encoding_for_model(\"gpt-3.5-turbo\")\n",
"tokens = encoding.encode(text)\n",
"number_of_tokens = len(tokens)\n",
"\n",
"print(number_of_tokens)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "tTeUaKlmU5lN",
"outputId": "3a5caedd-8c7f-4c9b-9327-71c8899cbd89"
},
"execution_count": 52,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"27619\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"!python -q -m spacy download en_core_web_sm"
],
"metadata": {
"id": "3mh5Sgn9VKOU"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"import spacy\n",
"from spacy.lang.en import English\n",
"\n",
"nlp = spacy.load(\"en_core_web_sm\")\n",
"\n",
"def text_to_chunks(text):\n",
" chunks = [[]]\n",
" chunk_total_words = 0\n",
"\n",
" sentences = nlp(text)\n",
"\n",
" for sentence in sentences.sents:\n",
" chunk_total_words += len(sentence.text.split(\" \"))\n",
"\n",
" if chunk_total_words > 2700:\n",
" chunks.append([])\n",
" chunk_total_words = len(sentence.text.split(\" \"))\n",
"\n",
" chunks[len(chunks)-1].append(sentence.text)\n",
" \n",
" return chunks"
],
"metadata": {
"id": "FfuVt8HbVOqp"
},
"execution_count": 54,
"outputs": []
},
{
"cell_type": "code",
"source": [
"chunks = text_to_chunks(text)"
],
"metadata": {
"id": "ixYPOU1YVYFZ"
},
"execution_count": 55,
"outputs": []
},
{
"cell_type": "code",
"source": [
"!pip install -q openai"
],
"metadata": {
"id": "Xs7KRlwYVo2o"
},
"execution_count": 56,
"outputs": []
},
{
"cell_type": "code",
"source": [
"import openai\n",
"\n",
"openai.api_key = OPENAI_API_KEY\n",
"\n",
"def summarize_text(text):\n",
" prompt = f\"Summarize key points from the audio transcript:\\n{text}\"\n",
"\n",
" for i in range(4): \n",
" try:\n",
" completion = openai.ChatCompletion.create(model=\"gpt-3.5-turbo\", messages=[{\n",
" 'role': 'system',\n",
" 'content': 'You are a helpful summarizer'\n",
" },\n",
" { 'role': 'user', \n",
" 'content': prompt \n",
" }])\n",
"\n",
" return completion.choices[0].message.content\n",
" except openai.error.OpenAIError as e:\n",
" print(f\"Error encountered. Retrying... ({i + 1}/4)\\n{e}\")\n",
" continue\n",
"\n",
" raise Exception(\"Unable to summarize text after 3 attempts.\")"
],
"metadata": {
"id": "yw-x5v6aVeG_"
},
"execution_count": 57,
"outputs": []
},
{
"cell_type": "code",
"source": [
"chunks = text_to_chunks(text)\n",
"\n",
"chunk_summaries = []\n",
"\n",
"for chunk in chunks:\n",
" chunk_summary = summarize_text(\" \".join(chunk))\n",
" chunk_summaries.append(chunk_summary)\n",
" print(chunk_summary)\n",
"\n",
"summary = \" \".join(chunk_summaries)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "Sh9WtYnwWAOx",
"outputId": "cbd4ba95-d13d-40df-cb81-3ab294fe7006"
},
"execution_count": 58,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"The transcript is a recording of a live performance by musician Dan Deacon at the Google I/O '23 event. He begins by playing a song called \"When I Was Done Dying\" followed by a guided visualization exercise. He talks about his interest in AI and technology's impact on music composition. He reveals that the band he has been performing with is called \"Chip Tune\" and plays a new track they created using AI. He ends the performance with a song called \"Manifesting a Duck with Lips\" and encourages the audience to collectively manifest this creature into reality.\n",
"The transcript covers a portion of the 2019 Google I/O event where the CEO discusses the company's focus on AI and how it is working on improving its products to be more helpful to its users. He provides specific examples of AI-powered features in Gmail, Maps, and Photos. The CEO also talks about the development of the latest PaLM 2 model and its specialized versions focused on medical and security domains. The company is also investing heavily in AI responsibility, including techniques to identify synthesized content using watermarking and metadata. Overall, the focus is to make AI more helpful for everyone in areas such as improving knowledge and learning, boosting creativity and productivity, enabling developers and businesses, and building and deploying AI responsibly.\n",
"The audio transcript covers the announcement of updates to Google's conversational AI, Bard, and how large language models are improving productivity in Google Workspace. Bard has improved its programming capabilities and now collaborates on tasks like code generation and debugging. It can also help users write emails and documents, and soon generate images. With the new Duet AI for Workspace, users can collaborate with AI through prompts and contextual suggestions. The presentation also covered how AI can help with job descriptions, organizing data in Sheets, and generating images in Slides. The company also announced the removal of the Bard waitlist and its availability in over 180 countries, with plans to support 40 languages soon.\n",
"The audio transcript discusses the use of AI in various Google platforms such as Duet AI for Workspace and Search. Sidekick, a new AI-powered feature in Duet AI for Workspace, can read and process documents and provide suggestions and images. Search has implemented generative AI to provide users with more comprehensive search results and information. Google provides advanced computing infrastructure and tooling for businesses to innovate with AI and maintain enterprise-grade safety, security, and privacy.\n",
"Google is using the power of AI to transform the way developers work, with thousands of companies already using Google's generative AI platform. Google Cloud offers three ways for individuals and enterprises to take advantage of the opportunity in front of them: building generative applications with AI platform Vertex AI, retrieving fresh and factual information with Enterprise Search, and controlling their data's privacy and the costs of using generative AI models. The company is partnering with other firms, including Character AI and Salesforce, to integrate Google Cloud's AI models with their services. Developers also have access to the PaLM API for language models, running on Google's AI-optimized infrastructure. A responsible approach to AI is paramount, with Google ensuring to establish its AI Principles before developing any AI application, especially as generative AI makes it easier to create new content and raises concerns about trustworthiness.\n",
"Google is adding two new ways to evaluate images, including an \"About this Image\" tool in Google Search that provides context to determine if an image is reliable. Later this year, the tool will be available when searching for images or on websites in Chrome. Google is also implementing metadata for AI-generated images to provide context. On the topic of AI, Google introduced an experimental AI video dubbing service called Universal Translator, which can translate a speaker's voice while matching lip movements. While the service has potential for learning and comprehension, there is also a potential for misuse by bad actors to create deep fakes. Sameer discussed Android's complete ecosystem of devices that work together, including upgraded Find My Device experience, new features for watches and tablets, and upgrades to RCS messaging. Dave discussed new personalization options with generative AI, such as Magic Compose for messages, customizable lockscreen shortcuts, and Emoji wallpapers.\n",
"During the Google I/O event, it was announced that the Pixel devices will be getting new features such as cinematic and generative AI wallpapers, which allow users to create 3D wallpapers from regular photos or choose prompts and themes to generate new original wallpapers. Additionally, the Pixel phone was praised for its AI-driven hardware, including the Google Tensor G2 chip, which adapts to users' needs and preferences and makes Pixel devices stand out from other smartphones. The Google Pixel 7a was also introduced, which has upgraded camera hardware and is available starting at $499. Finally, the event showcased the new Pixel Tablet, which is designed to be a helpful home device with features such as a charging speaker dock, a built-in stand, and Chromecast built-in. It is available for pre-order today and comes bundled with a free charging speaker dock.\n",
"In the audio transcript, Google introduces the Pixel Fold, an ultra-premium foldable device with a versatile form factor great for using both folded and unfolded. It has an expansive 7.6-inch display and triple rear camera hardware, making it the best foldable camera system available. The Pixel Fold is built to last, with an IPX8 water-resistant design and the most durable hinge of any foldable. Google is also making huge strides with large-screen devices, including improvements for Android that allow for faster typing, multi-tasking, and switchable displays within apps. Additionally, Google's Project Starline is working to bring people together virtually with a 3D live image of the remote person.\n",
"The audio transcript covers several topics, including building your own technology, using games to close the education gap, developing an app to control stuttering, and introducing the I/O Flip game powered by Google's AI technology. The founders of Generation Games discuss closing the math gap in underserved communities, making education relevant, and combining history and entertainment. The founder of the Equalizer app discusses developing the app during his rehabilitation after a back injury. The developers of I/O Flip talk about using Flutter, Firebase, and Google Cloud to create a classic card game with a modern AI twist. The game features customized cards with classes and special powers, and is easy to play and available on multiple devices.\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"number_of_tokens_summary = len(encoding.encode(summary))\n",
"number_of_tokens_summary"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "2RFc0IMPWGrI",
"outputId": "4b3dc7d3-aab8-42e8-a461-a65b8a65f94c"
},
"execution_count": 59,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"1283"
]
},
"metadata": {},
"execution_count": 59
}
]
},
{
"cell_type": "code",
"source": [
"summary_of_summary = summarize_text(summary)"
],
"metadata": {
"id": "q7DMyVz2YZim"
},
"execution_count": 60,
"outputs": []
},
{
"cell_type": "code",
"source": [
"summary_of_summary"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 127
},
"id": "CE1vCv86YgvM",
"outputId": "95ed54fa-1ea5-45ff-e437-52a6dde97514"
},
"execution_count": 61,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"\"The audio transcript covers several topics from the 2019 Google I/O event. Dan Deacon performs songs and talks about his interest in AI and technology's impact on music composition. Google's CEO speaks about the company's focus on AI and its improvements to products. Updates to Google's conversational AI, Bard, and other AI-powered features such as Search are discussed. Google Cloud offers ways for individuals and enterprises to take advantage of AI. The Google Pixel devices receive new features such as cinematic and generative AI wallpapers. Google also introduces the Pixel Fold and Project Starline. Lastly, the transcript covers topics such as developing technology, using games for education, and introducing the I/O Flip game powered by AI technology.\""
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 61
}
]
},
{
"cell_type": "code",
"source": [
"completion = openai.ChatCompletion.create(model=\"gpt-3.5-turbo\", messages=[{\n",
" 'role': 'system',\n",
" 'content': 'You are a helpful summarizer'\n",
" },\n",
" { 'role': 'user', \n",
" 'content': 'Transform the following transcript into bullet points and summarize the most important information:\\n' + summary\n",
" }])\n",
"\n",
"summary_of_summary = completion.choices[0].message.content"
],
"metadata": {
"id": "9R75NCJ9Y6qT"
},
"execution_count": 63,
"outputs": []
},
{
"cell_type": "code",
"source": [
"pprint(summary_of_summary.replace('\\n- ', '<br/>- '))"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 243
},
"id": "UkDqx8v_ZP7_",
"outputId": "83b2d5a4-2b24-42be-a2e8-6e1b7865946d"
},
"execution_count": 68,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"<IPython.core.display.HTML object>"
],
"text/html": [
"- Musician Dan Deacon performs at Google I/O '23, playing songs and discussing the use of AI in music composition.\n",
"<br/>- Google CEO discusses the company's focus on AI and provides examples of AI-powered features in Gmail, Maps, and Photos.\n",
"<br/>- Updates to Google's conversational AI, Bard, are announced, including its availability in over 180 countries and the introduction of Sidekick for collaborative document processing.\n",
"<br/>- Google Cloud offers three ways for individuals and enterprises to take advantage of AI: building generative applications with AI platform Vertex AI, retrieving fresh and factual information with Enterprise Search, and controlling data privacy with generative AI models.\n",
"<br/>- Google is partnering with other firms, including Character AI and Salesforce, to integrate Google Cloud's AI models with their services.\n",
"<br/>- Google is adding new ways to evaluate images, including an \"About this Image\" tool and metadata for AI-generated images.\n",
"<br/>- The Google Pixel 7a is introduced, featuring upgraded camera hardware and starting at $499.\n",
"<br/>- The Pixel Fold is introduced as an ultra-premium foldable device with an expansive display, triple rear camera hardware, and durable hinge.\n",
"<br/>- Google's Project Starline is working to bring people together virtually with a 3D live image of the remote person.\n",
"<br/>- Founders of Generation Games discuss closing the math gap in underserved communities.\n",
"<br/>- The founder of the Equalizer app discusses developing the app to control stuttering.\n",
"<br/>- Developers of I/O Flip game talk about using Flutter, Firebase, and Google Cloud to create a classic card game with a modern AI twist."
]
},
"metadata": {}
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment