Build An Audio AI App Transcripts
Chapter: Tour of Starter App
Lecture: Code and Requirements

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Here we are in the GitHub repo, and let's just start where I recommended you start. Let's go up here and clone it.
0:09 Notice down here, we now have a code 00 starter app, and there's gonna be more 01, this feature, 02, that feature, and so on.
0:18 But down here, it even comes with instructions on what to do, so this is what we're gonna talk through,
0:23 but it's also written down right here in the readme. Step number one, we're gonna go and clone it. Now, I'm just gonna clone it to the desktop for now
0:31 so you can see what's happening, then I'll move it somewhere else later that you don't need to worry about. Also, I have a non-default terminal.
0:40 This one is warp, and I recommend you check out warp if you're on Mac or Linux. Maybe later, they said they're working on a Windows version,
0:49 but it's not out yet. So sometimes people ask me, Michael, what is this weird terminal thing you've got going on? That's what it is.
0:55 So we're on the desktop. We'll just git clone, and we'll just put in the URL. You don't need the .git, by the way.
1:01 You can have it, but it's not required. And here it is over on the desktop. It'll be called audio something or other.
1:11 So you can see we've got our readme. That's just not, that's not the one I was talking about. That just talks about the overall project.
1:20 We go into code, and we'll have the starter app here. And then this is the place that we're gonna be working. So for each one of these, we've got,
1:30 I'll open it up in Finder here for you. Each one of these has kind of got this top-level point-in-time name, so starter app, finished with transcripts,
1:42 or whatever we end up calling these. And it's got the node modules, and the source, and the requirements. So I recommend that you open up this folder,
1:50 or whatever section of the course, or point-in-time you wanna work with, into your editor. And because of that, I'm over here,
2:00 and we're gonna do a couple of things. First of all, notice there's no virtual environment. It does show there's this global one,
2:07 but I run with a virtual environment active all the time on my computer in case I wanna blow it away. It doesn't mess with System Python.
2:15 So what I'm gonna do is I'm gonna create a virtual environment. That's the first thing that we wanna do because you can see we have some requirements.
2:22 In fact, quite a few that we're gonna need for this app to run, and that's just a good practice. So we will say Python -m venv, venv.
2:31 Now, that would be fine, but I would like, see how this one is named global, not just venv. We can say --prompt.
2:40 And when that creates this virtual environment, the name is going to be just venv. But when we activate it, so this varies
2:53 depending on your operating system also laid out in that readme right here. On macOS and Linux, you say dot for apply to this shell.
3:02 Then you say venv/bin/activate, like so. Notice how it's 00starterapp, so it tells me which one it's in.
3:13 If I was on Windows, I would do venv scripts/activate.bat, why, oh why, for all that is right, do these have to be named separately?
3:24 I don't know, but that's the way it is. So that's one of the weird differences between Python on Windows and Mac, so we gotta do this.
3:32 Next, we need to get those requirements. I use piptools, and piptools takes this file, which is just the top-level unspecified requirements,
3:44 and compiles it, something like compiles it to, this more specific version. So what we're gonna do is, you don't need to use piptools,
3:54 you can just simply go here and pip install the requirements, but if you wanna mess with that and upgrade it, you're welcome to.
4:00 So I'll say pip install-r requirements.txt, virtual environment active, and as always, Python is always, always,
4:13 almost always, except for one or two weeks a year, out of date with its pip, so I actually have a thing that normally creates virtual environments
4:21 and automatically upgrades it, but it's not required, but go ahead and upgrade it, just so it doesn't complain to you. Okay, and there we have it.
4:29 We've got our virtual environment created, we've got it activated, the things we need to run the app are here.
4:37 So we could come over here and just say Python main and run our app, but at this point, I kinda wanna put the terminal and the shell down
4:44 and go over to a proper editor. So this folder is what I want to be the base, so in PyCharm on macOS, macOS only, you can do this, drag and drop it,
4:56 and it will open up this project. On Windows, you have to say file open directory and browse to it, not a huge deal, but that's how it works.
5:06 All right, here we have it in our program, and notice, got our source files down here, this is where all the code that we're working with.
5:15 One more thing we have to do before we're able to run this is we need to set things like the assembly AI API key.
5:23 Should that stuff be committed to Git? No, no, no, no, no, no, no, no, it should not. So what I've done here is I've created this settings file
5:35 that has a template default values for just local host server, but then here's where your API key goes. So what we're gonna do is we'll talk later
5:46 about the API key, but in order for the app to run, it just expects this file to be there, and later we'll go and enter our key in there.
5:52 If you already got it, go ahead and put it. Don't put it into this template. The goal is do what the action says, make a copy, save it to settings,
6:00 and in here put, and this is no longer needed, and put my API key. I'm gonna put my API key there, but you know what?
6:12 I'm not gonna share it with everyone because that one's mine, you put yours there. So with all of that in place, we should be able to run this,
6:20 although without MongoDB being here yet, it won't really work, so that's one more thing I'm gonna do before we actually go and run this code.


Talk Python's Mastodon Michael Kennedy's Mastodon