It feels like 100 videos ago that I told you that we were going to have instant gratification with our
first project, and you'd be within your rights to feel like it hasn't exactly been instant gratification.
But never fear, I'm going to make up for it with a nice juicy project to start us off.
So if you already have JupyterLab running like the window up in your browser, please close that.
And if you already had your Anaconda prompt in windows, then exit out of that and close that and start
again.
Bring up a fresh Anaconda prompt in a PC and on a mac, bring up a fresh, uh, terminal, having closed
everything down because we've made that env file and I want to start from absolute scratch.
Go into your projects folder into LM engineering, and you'll remember the first thing.
And you'll always have to do this if you come in fresh with a, with or without your Jupyter Lab running,
you type conda activate LMS.
That is how you activate your environment.
If you're using virtualenv, then there was a different PC and a mac way of doing it in the readme.
I do that, and my clue is that the prompt has now changed to LMS.
And for windows people in your Anaconda prompt, it should have done the same thing.
And now you type the two wonderful words Jupyter Lab.
And when you do that, it thinks for a second and up comes JupyterLab right here.
Instant gratification.
It says.
So you may not see this.
Actually, it may come up for you the first time just looking like this.
Perhaps this might be more similar to what you're seeing right now.
So this is Jupyter Lab for some people.
This is old news.
You've probably used this a lot.
For some of you, this might be new.
And I'm here to tell you that it is fabulous.
It is this very interactive way for data scientists to work with code.
It's full of some hairy stuff like use global variables a lot in Jupyter Lab.
And we know, as if you're from an engineering background that that's not not very good behavior, but
it's something that we do as part of research and development.
And so we just do it.
As you will see, it means that you can be very productive as you experiment.
When we get to week eight, at the end of the course, we're going to be looking at productionizing,
the stuff that we do, and we'll be talking about how we migrate from JupyterLab into proper code and
deployment and so on.
But we don't need to worry about that stuff now.
So on the left here, you have something called the File Browser, which is kind of what you would expect
actually, you might have come in like this, of course, which is showing you the parent directory.
There's a directory for each of the weeks that we'll be going through, and you can see the things we
know about the Readme and the environment.yml here as well.
And without further ado, we're going to go into week one.
Now, if this is your first time ever in JupyterLab, I've made a guide to JupyterLab that you can come
into and look at you.
Just double click here and it will bring it up, and it will take you on a quick tour of what you need
to do, just so that you get a handle of things.
For example, you'll learn that you can click in one of these boxes here, which is called a cell.
You hold down shift.
You press return or enter on your keyboard and it executes it and prints the results for and as you
go through, you scroll down and you go on to do the next thing, and you can just come in and execute
and see.
My favorite fruit is bananas, and you can go through and use this guide to Jupiter as a way to learn
some of the tricks of using Jupiter Lab, and I hope that will be helpful for you.
But I imagine many of the people on this course will have used Jupiter once or twice and will be familiar
with the wonder of it.
And so that brings us to our day one project, which is right here.
And again, I've slightly cheekily called it instant gratification.
I know you've put in a fair amount of work for this, and day one has been a pretty long day, but it
hopefully will be worth it.
Uh, there's some spiel here to remind you one more time that I'm here to help.
There's my email address.
This is my LinkedIn.
I always love it if people connect with me on LinkedIn.
It's nice if you if you put a message there to say hi, but you really don't need to as well.
If you just want to just connect, that's good with me.
I always will accept connections from people taking this course.
Of course.
The other thing it tells you right here is that there is another notebook.
And sorry, these these Jupyter labs are known as notebooks.
People call them for historical reasons.
Uh, there's another notebook here called troubleshooting.
And troubleshooting is where you will go if you have any problems troubleshooting over here.
Uh, begins.
Oh, dear.
Uh, has step by step to go through and figure out exactly what's going wrong and check your env file.
Looks good.
I check everything as we go through it.
So if any troubles at all, you go to troubleshooting and we'll have it sorted.
But otherwise we're starting with the day one notebook.
Generally during this course, we'll have a separate notebook for each day so that you can go through
and learn from that day and do the exercises.
Okay.
So the first thing we start with is some imports.
I often like to put the imports at the top.
You have to execute the code in JupyterLab from the top downwards, and we'll start by clicking in this
import cell.
Hold down shift.
Press return.
And that runs.
If this gives you an error, then head over to the troubleshooting notebook.
I'll tell you what's probably happening, what's going on, and what you need to do about it.
Most likely is that for some reason, the conda environment isn't activated.
And I'll tell you what to do about that.
Okay.
The next thing we're going to do is connect to OpenAI.
So this is where we are going to to make our connection to the OpenAI API service so that we can make
a call to GPT, the frontier model and and ask it questions.
Now, of course, we're going to be talking a lot more about OpenAI and GPT and what all these things
mean.
The idea is to get a flavor for it.
Right now, this is just our first lab.
So the first thing we do is call something called load dot env.
And that looks at the dot env file and loads in our secrets.
Right now we have one secret the OpenAI API key.
And we're going to load that in and put it in a variable called API key.
And we're going to check that it looks decent.
It says API key found and looks good so far.
If it doesn't say that.
If it doesn't say.
API key found and looks good so far, head over to troubleshooting.
We'll sort it out or.
Email me uh, LinkedIn with me.
We'll fix it okay.
The next thing we do is this simple thing here.
We take OpenAI.
We we create an instance of it and put it in OpenAI.
Uh, this is where we're.
Actually making the connection to OpenAI done.
All right.
So what is this project going to be about today?
What what business problem are we actually going.
To solve?
It's going to be really simple and actually quite cool.
We're going to write a program which is going to be able to look at any web page on the internet, scrape
the contents of the web page and then summarize it and present back a short summary of that web page.
You can think of it like you're building your own little web browser, which is like a summarizing web
browser.
Uh, you know, the Reader's Digest.
It's like a Reader's Digest web browser.
Um, that's what we're going to do.
That's going to be the project.
And we're going to start by defining a class, a class website, and which is going to be a very simple
utility class that will represent a website that we've scraped.
Uh, it's going to be a class which, which will have a URL, a title and a text.
I'm not going to go through this line by line, because you'll be able to read this yourself and get
a sense for it as you come through and execute this right after this, uh, and we'll have other labs
where we'll go into much more detail on what's going on.
This is just about your first your first experience with it.
Now in this, uh, in the constructor and where I set up this class, I use a package called Beautifulsoup,
which again, I imagine many of you have come across at some point.
It's a fabulous little package that's used for parsing web pages and people who do web scraping, uh,
on a regular basis, like myself, know Beautifulsoup very well indeed.
Uh, and you can use Beautifulsoup to do things like pluck out the title of a web page and get rid of
things like scripts and style and images and inputs from a web page and then figure out its text.
So that is what we're going to do with our, uh, um, uh, class website.
And then what we're going to do finally is try one out.
So we're going to create a new website object.
And I'm going to pass in this particular website for thoroughly undesirable website happens to be my
website.
Uh, and it's a very vanilla website.
But we'll create a class to represent it.
Uh, we'll look at its title and look at the text on the website.
Let's see if this works.
Yes it works.
And here we go.
We're seeing the name of the website.
Uh, and there is something about what's going on on that website right there.
Uh, this is just the contents looking a bit scrappy because it's of course, the contents of that web
page with images, JavaScript stylesheets all removed.
Okay, so far we've not done anything to do with generative AI or Llms.
That's coming right up, and we're going to get to it in the next video.