Hello everyone. In the previous video, we have finally tested our pipeline and we got amazing results. But before we put everything from our notebook to our flask application, we need to organize our file somehow. So in this video, we are going to do exactly that. Because these steps are pretty much copy pasting code from one place to another. I've already created files, and I'll walk you through them.
Please note if you want to, you can download the code from my GitHub account and jump right to the next tutorial. If you want to organize your code yourself, follow this video. And as you can see, I've created a bunch of Python files and organized some functions from the Jupiter notebook. Also, there are some new folders which we are going to discuss in this video. The first one is utils. It has three Python scripts, one for data set helper function, one for model helper functions, and The last one is general utils functions, distances, accuracy and so on.
Let's walk through each one of them. In utils.pi, we have free functions, cosine distance, hamming distance and sparse accuracy. In the data set.py. We have on two functions, image loader and datasets pre processing. And lastly, for the utils part of the code, we have models.py, which has all our model related functions. In the root directory, I created the models.py only this time it is the model itself.
It has the image search model class inside it, and it calls all helper functions from the utils folder. There are two more newly created Python files inside the root directory, train dot p y and inference dot p y in the train dot v y we only have the train function and the function that we have used to create training set vectors. At the very end of this file, I have commented the training script that we had used in an ml file. Lastly, there is inference dot p y, which is the most important file and the function for production. Just to mention, I created this config dot p y file, which is not important, but I like to implement stuff this way. So all my hyper parameters are in one place for the whole project.
This all for the notebook function parts. The last thing that I need to explain are two newly created folders, static and templates. In case you haven't worked with the flask library before, each application built in flask should have these two folders. In the templates folders, we put all HTML files for our application. In our case, we have only two of them in there. And results.
Now we have the static folder. Inside this folder will put all static files, CSS, j, s, images, and so on. In our case, we only have a sub folder called images in which you put the whole training set. So 50,000 images. This will allow us to access every single image with a simple path. And that's it for our file organization.
In the next tutorial, we're going to start building our flask application. So if you have any questions in the meantime, post them in the comment section. Otherwise, I'll see you in the next tutorial.