1 00:00:00,420 --> 00:00:02,40 - [Instructor] So that kind of was a walkthrough 2 2 00:00:02,40 --> 00:00:04,260 of how to do this for one single episode. 3 3 00:00:04,260 --> 00:00:05,970 But of course we want to process 4 4 00:00:05,970 --> 00:00:08,220 lots and lots of podcast episodes 5 5 00:00:08,220 --> 00:00:10,920 and it would be kind of annoying to, you know, 6 6 00:00:10,920 --> 00:00:12,900 run through the code that I've showed you here 7 7 00:00:12,900 --> 00:00:16,140 and just do this for each podcast episode one at a time. 8 8 00:00:16,140 --> 00:00:20,340 So I have here some nice functions that are going to help us 9 9 00:00:20,340 --> 00:00:23,730 to bulk process podcast episodes so that we can do this. 10 10 00:00:23,730 --> 00:00:25,260 And then we can ask a question 11 11 00:00:25,260 --> 00:00:26,580 that's a little bit more interesting 12 12 00:00:26,580 --> 00:00:29,130 and a little bit more specific over all of the episodes 13 13 00:00:29,130 --> 00:00:31,680 in the "DeepMind Podcast" feed. 14 14 00:00:31,680 --> 00:00:34,350 So this first function here is called get_episodes, 15 15 00:00:34,350 --> 00:00:38,70 and this essentially parses the RSS feed 16 16 00:00:38,70 --> 00:00:39,30 that we looked at earlier. 17 17 00:00:39,30 --> 00:00:41,340 So it's using that feedparser library. 18 18 00:00:41,340 --> 00:00:44,490 There is a limit if you want to only extract a few, 19 19 00:00:44,490 --> 00:00:46,500 just to test this out. 20 20 00:00:46,500 --> 00:00:48,630 But of course, if you're doing this for a real example, 21 21 00:00:48,630 --> 00:00:52,710 you'll want to process all of the podcasts in the RSS feed. 22 22 00:00:52,710 --> 00:00:56,430 The next step is to download the audio for a single episode. 23 23 00:00:56,430 --> 00:01:00,420 So it takes in basically the URL for a particular episode. 24 24 00:01:00,420 --> 00:01:03,780 So we'll process one single episode 25 25 00:01:03,780 --> 00:01:05,130 and then we have a function here 26 26 00:01:05,130 --> 00:01:06,810 that is called transcribe audio. 27 27 00:01:06,810 --> 00:01:09,450 So this is going to transcribe the audio. 28 28 00:01:09,450 --> 00:01:12,720 And again, this looks very similar to what we did earlier, 29 29 00:01:12,720 --> 00:01:14,250 that there is this prompt here 30 30 00:01:14,250 --> 00:01:16,320 to the model saying transcribe this audio, 31 31 00:01:16,320 --> 00:01:18,300 output only the transcription, et cetera. 32 32 00:01:18,300 --> 00:01:20,580 And we're telling Gemini 3 Pro Preview 33 33 00:01:20,580 --> 00:01:23,520 to take in this audio file and transcribe it. 34 34 00:01:23,520 --> 00:01:25,590 The only difference here is I've got a little bit 35 35 00:01:25,590 --> 00:01:27,240 of some error handling 36 36 00:01:27,240 --> 00:01:28,830 and print statements over here, 37 37 00:01:28,830 --> 00:01:30,780 which I didn't have earlier when I was just going through 38 38 00:01:30,780 --> 00:01:31,647 the Colab cells. 39 39 00:01:31,647 --> 00:01:34,140 But this will be useful if you're transcribing 40 40 00:01:34,140 --> 00:01:35,940 a bunch of podcasts at once 41 41 00:01:35,940 --> 00:01:39,720 to just have some messages in case something goes wrong. 42 42 00:01:39,720 --> 00:01:42,630 The next function here is process_episode, 43 43 00:01:42,630 --> 00:01:46,470 and this essentially combines the previous three functions. 44 44 00:01:46,470 --> 00:01:50,130 So you can see that it takes in a single podcast episode, 45 45 00:01:50,130 --> 00:01:53,160 it downloads the audio, it transcribes the audio, 46 46 00:01:53,160 --> 00:01:54,930 and then it uploads the transcription 47 47 00:01:54,930 --> 00:01:56,310 to our File Search store. 48 48 00:01:56,310 --> 00:01:59,610 So if we call this function over every single episode 49 49 00:01:59,610 --> 00:02:01,170 in that RSS feed, 50 50 00:02:01,170 --> 00:02:04,110 we will essentially have a File Search store 51 51 00:02:04,110 --> 00:02:07,530 with transcriptions of all of our podcast episodes 52 52 00:02:07,530 --> 00:02:08,850 and we're ready to go 53 53 00:02:08,850 --> 00:02:11,310 and we will be able to ask the model questions 54 54 00:02:11,310 --> 00:02:14,430 about the information in those podcasts. 55 55 00:02:14,430 --> 00:02:15,840 So one last function, 56 56 00:02:15,840 --> 00:02:17,910 which was the one we're actually going to execute now, 57 57 00:02:17,910 --> 00:02:19,620 and which will actually do something. 58 58 00:02:19,620 --> 00:02:22,800 And this basically just calls that process_episode 59 59 00:02:22,800 --> 00:02:27,150 across all of the episodes in the RSS URL. 60 60 00:02:27,150 --> 00:02:29,970 So I'm going to execute this cell right now 61 61 00:02:29,970 --> 00:02:31,590 so I have it just limited to 10 62 62 00:02:31,590 --> 00:02:32,880 because this will take a bit of time. 63 63 00:02:32,880 --> 00:02:34,530 I don't want to process everything, 64 64 00:02:34,530 --> 00:02:37,140 but I'm also using a couple of workers 65 65 00:02:37,140 --> 00:02:38,400 just to make this go faster. 66 66 00:02:38,400 --> 00:02:40,320 So if we look at the output here, 67 67 00:02:40,320 --> 00:02:42,570 you'll see that things are kind of going to happen 68 68 00:02:42,570 --> 00:02:43,470 out of order. 69 69 00:02:43,470 --> 00:02:45,750 You won't see, you know, a particular episode 70 70 00:02:45,750 --> 00:02:48,390 that got processed and transcribed and uploaded. 71 71 00:02:48,390 --> 00:02:51,450 You'll see things kind of happening sort of out of order. 72 72 00:02:51,450 --> 00:02:53,880 But this is basically going to take the first 10 episodes 73 73 00:02:53,880 --> 00:02:57,870 in the RSS feed and get them into our File Search store. 74 74 00:02:57,870 --> 00:02:59,460 So this is going to take a bit of time. 75 75 00:02:59,460 --> 00:03:01,800 I'm going to go ahead and actually just stop the execution 76 76 00:03:01,800 --> 00:03:04,920 of this cell because I already have a file search store 77 77 00:03:04,920 --> 00:03:07,710 that I prepared ahead of time, which has all 78 78 00:03:07,710 --> 00:03:09,990 of the "Google DeepMind Podcast" episodes in it. 79 79 00:03:09,990 --> 00:03:11,430 So, so we don't have to sit here 80 80 00:03:11,430 --> 00:03:13,650 and watch this thing upload one at a time. 81 81 00:03:13,650 --> 00:03:16,290 I just killed that cell and we can test out 82 82 00:03:16,290 --> 00:03:18,870 the existing store that I had. 83 83 00:03:18,870 --> 00:03:22,800 So my prompt here is about a particular episode 84 84 00:03:22,800 --> 00:03:24,660 that I remember listening to. 85 85 00:03:24,660 --> 00:03:25,860 I was in the car driving 86 86 00:03:25,860 --> 00:03:27,780 and I was listening to the "Google DeepMind Podcast" 87 87 00:03:27,780 --> 00:03:30,990 and I remembered that there was an episode where Four Flynn, 88 88 00:03:30,990 --> 00:03:33,720 who is the VP of Security at Google DeepMind 89 89 00:03:33,720 --> 00:03:36,30 that was telling the story about a fish tank. 90 90 00:03:36,30 --> 00:03:37,920 It was something to do with a fish tank and security, 91 91 00:03:37,920 --> 00:03:39,300 and I wanted to tell a friend later, 92 92 00:03:39,300 --> 00:03:41,460 but I couldn't remember exactly what it is 93 93 00:03:41,460 --> 00:03:44,520 that the story was or like what the details were. 94 94 00:03:44,520 --> 00:03:48,600 So I have this prompt here about this episode 95 95 00:03:48,600 --> 00:03:50,910 where Four was telling a story about a fish tank. 96 96 00:03:50,910 --> 00:03:52,410 What was that about? 97 97 00:03:52,410 --> 00:03:55,920 And so now we're going to call generate_content again. 98 98 00:03:55,920 --> 00:03:57,810 Okay, so we did get the response back from the model. 99 99 00:03:57,810 --> 00:04:01,20 You'll notice that it actually printed out this information 100 100 00:04:01,20 --> 00:04:03,00 right here about uploading transcripts. 101 101 00:04:03,00 --> 00:04:04,350 That is a little confusing. 102 102 00:04:04,350 --> 00:04:06,720 It is not at all what was actually happening 103 103 00:04:06,720 --> 00:04:09,930 in this generate_content call to the model. 104 104 00:04:09,930 --> 00:04:12,780 This is actually the output of this cell over here, 105 105 00:04:12,780 --> 00:04:13,740 which I interrupted. 106 106 00:04:13,740 --> 00:04:15,630 So sometimes Colab does this 107 107 00:04:15,630 --> 00:04:18,180 if you interrupt a long-running process 108 108 00:04:18,180 --> 00:04:20,10 and you kind of stop the cell, 109 109 00:04:20,10 --> 00:04:22,740 the output might still get uploaded right over here. 110 110 00:04:22,740 --> 00:04:24,360 So don't worry too much if that happens. 111 111 00:04:24,360 --> 00:04:25,800 You might not see it, you might see it, 112 112 00:04:25,800 --> 00:04:27,420 but just don't worry about it. 113 113 00:04:27,420 --> 00:04:28,770 Now that the cell is executed, 114 114 00:04:28,770 --> 00:04:31,350 we can take a look at the response 115 115 00:04:31,350 --> 00:04:34,620 and hopefully we will have information about the fish tank. 116 116 00:04:34,620 --> 00:04:36,900 So it says, based on the search results, 117 117 00:04:36,900 --> 00:04:39,420 the episode you're referring to is likely 118 118 00:04:39,420 --> 00:04:40,560 Pt. 1 Beyond Phishing. 119 119 00:04:40,560 --> 00:04:41,550 Oh, and this is great too 120 120 00:04:41,550 --> 00:04:43,980 because I remember that Four Flynn, 121 121 00:04:43,980 --> 00:04:45,780 who was the person being interviewed, 122 122 00:04:45,780 --> 00:04:48,720 they had two episodes on the "DeepMind Podcast." 123 123 00:04:48,720 --> 00:04:51,720 So even though I knew that the person's name, 124 124 00:04:51,720 --> 00:04:53,670 I couldn't quite use that to just, you know, 125 125 00:04:53,670 --> 00:04:55,140 manually search on my podcast app 126 126 00:04:55,140 --> 00:04:56,430 because I couldn't remember which episode 127 127 00:04:56,430 --> 00:04:57,570 it was actually in. 128 128 00:04:57,570 --> 00:05:00,120 But it seems like it was in part one. 129 129 00:05:00,120 --> 00:05:02,670 And let's see what the story was. 130 130 00:05:02,670 --> 00:05:05,970 So this is a famous cybersecurity anecdote 131 131 00:05:05,970 --> 00:05:08,430 about a fish tank in a Las Vegas casino, 132 132 00:05:08,430 --> 00:05:12,480 and it seems that the device lacked strong security. 133 133 00:05:12,480 --> 00:05:16,50 And so it was used as a pivot point for hackers 134 134 00:05:16,50 --> 00:05:19,980 to break into the network and then be able to move laterally 135 135 00:05:19,980 --> 00:05:21,420 to more sensitive systems. 136 136 00:05:21,420 --> 00:05:22,950 So it's a pretty interesting story. 137 137 00:05:22,950 --> 00:05:25,920 I guess it's like a classic story in cybersecurity. 138 138 00:05:25,920 --> 00:05:28,950 And now I can remember the details of it 139 139 00:05:28,950 --> 00:05:30,690 with the help of Gemini. 140 140 00:05:30,690 --> 00:05:32,970 And then just as before, if we wanted to take a look 141 141 00:05:32,970 --> 00:05:34,320 at the metadata as well, 142 142 00:05:34,320 --> 00:05:36,480 you would be able to see kind of the chunks 143 143 00:05:36,480 --> 00:05:39,180 of where this information came from, 144 144 00:05:39,180 --> 00:05:41,580 and we can correlate that with parts of the response 145 145 00:05:41,580 --> 00:05:43,650 if we wanted to have like a nice citation 146 146 00:05:43,650 --> 00:05:46,200 for where this information came from. 147 147 00:05:46,200 --> 00:05:48,480 But that's all for showing you how to build 148 148 00:05:48,480 --> 00:05:50,70 your podcast app. 149 149 00:05:50,70 --> 00:05:51,210 If you want to do this for real, 150 150 00:05:51,210 --> 00:05:53,640 definitely check out the GitHub repo 151 151 00:05:53,640 --> 00:05:55,590 and you can go and find an RSS feed 152 152 00:05:55,590 --> 00:05:58,200 for a podcast that you listen to, 153 153 00:05:58,200 --> 00:05:59,430 process all the information 154 154 00:05:59,430 --> 00:06:03,150 and then you'll be able to retrieve answers 155 155 00:06:03,150 --> 00:06:04,290 if you ever have questions 156 156 00:06:04,290 --> 00:06:07,00 about all of the good stuff stored in that podcast.