K-Means Python script to Flask application (step by step) - PART #1
This tutorial demonstrates how to build a stylish #Flask application from a single Python code executing K-means clustering (unsupervised learning). The main idea of that is we need to have centroids of clusters generated by K-means saved to be used by Flask application later. The input value for specified features entered directly in web browser window via built Flask application, and then send to algorithm which calculates the Euclidean distance between entered values and fixed centroid positions. The predicted cluster is that which has the shortest distance between entered values and K-means centroids. Be noticed that fixed cluster centroids from K-Means are saved in a simple lightweight pickle (.pkl) file locally.
At the end of this tutorial, you will have a stylish web application which allows you to enter your values for the algorithm and get results in a second just after you click Submit button at the main page.
I suppose you are little (at least) familiar with HTML in web developing (required) and CSS (not required). If not, this is not difficult to build a nice app. Just by following steps in this video.
The content of the tutorial is:
0:00 – Introduction and DEMO
0:48 – Step #1. Python file for K-Means clustering
2:15 – Step #2. Prepare your project structure
4:25 – Step #3. Write your Flask application
11:45 – Step #4. Prepare a Landing page on index.html
19:08 – Step #5. Have your logo!
19:30 – Step #6. Prepare HTML page for results
20:50 – Step #7. Set-up your web application style with CSS
22:35 – Step #8. Test application and debug
24:16 – Final Flask application for clustering
25:36 – Bonus: Github repository for the project
Used resources:
- Fonts: Google Fonts from https://fonts.google.com
- Flask documentation (official): https://flask.palletsprojects.com/en/2.0.x/
- Github repo for the project: https://github.com/vb100/KMeans-FlaskApp
Once you have a working Flask based application locally, you can deploy it in the cloud provider that the application would be public and open worldwide, by using Docker, AWS, Azure, GCP, or other solution upon your business requirements.
Link to the Part 2: Deploy Flask application to AWS Beanstalk as a web app. (https://youtu.be/fGxY_Hji8_U)
Thanks for watching, hope it was useful!
#kmeans #centroids
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «K-Means Python script to Flask application (step by step) - PART #1», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.