In this post, I will discuss the steps I took to make my own LIFX web application using the Flask web framework.
This is a follow up post from last week, but you can download the repo. To recap, we used the Python and the LIFX API to control different requests sent to our wifi-enabled lights. In order to create an application we have to look at all the components. I usually start with a rough sketch or a whiteboard.
Here’s my whiteboard (don’t judge…):
To start, we need to access the LIFX HTTP API documentation. You will need a set of LIFX lights for this to work. All requests require an OAuth 2 access token from your account settings.
First we will need to create a global variable to store our access token. Then we can create methods to handle the different API requests.
import requestsclass LIFX(object): def __init__(self):
self.token = "your_access_token"
I want to be able to turn the lights on/off, and also switch to the preset light settings I’ve already configured on my phone. Before I begin, I will need…
Compare the top 200 supported assets on Kucoin’s decentralized exchange.
Everyone knows that one person, or couple, or teenager, that made millions on Bitcoin. While bitcoin is still the most popular digital asset with the highest market cap, there have been several advancements in blockchain technology since the world was introduced to the distributed ledger.
I am a crypto enthusiast and have a few friends that try to keep up with the crypto market like the stock exchange; except the crypto markets are open 24/7, and there are thousands of projects on hundreds of exchanges. …
I will also walk through the OSEMN framework for this machine learning example. The acronym, OSEMN, stands for Obtain, Scrub, Explore, Model, and iNterpret. This is the most common framework for Data Scientists working on machine learning problems.
With out further ado, let’s get started.
In this post, I will share how to deploy a pre-trained model to a locally hosted computer with Flask, OpenCV and Keras. I initially deployed this model on PythonAnywhere using Flask, Keras and jquery. The application was designed for remote school classroom or workplace settings that require students or employees to shave their facial hair.
The application allowed users to upload a photo, and click a button to send a post request with the encoded image data to the backend of the website. The image transformation and classification were handled on the backend, and the results were returned to the…
In my last post, “Building a Convolutional Neural Network to Recognize Shaved vs UnShaved Faces”, I ended the article sharing the method I used to save my final trained model with Pickle.
“Pickling” is the process whereby a Python object hierarchy is converted into a byte stream, and “unpickling” is the inverse operation, whereby a byte stream (from a binary file or bytes-like object) is converted back into an object hierarchy. — Source code: Lib/pickle.py
As a refresher, here is the line of code to pickle your final model, saving all the weights, without the hassle of saving the structure…
In this tutorial, we will use an image dataset created by scrapping free stock photo sites. The image set contains about 2,000 images of individual people labeled as “shaved” or “unshaved”. We will combine computer vision and machine learning to classify images using a Convolutional Neural Network (CNN).
By the end of this tutorial, you will be able to:
To code along, download my image dataset from Google Drive. All image data is stored…
This post was inspired by Fabian Bosler’s article Image Scraping with Python. Fabian does a great job explaining web scraping and provides a great boiler plate code for scraping images from Google. For our purposes, we will focus on using selenium in python to download free stock photos from Unsplash.
Unsplash is a website dedicated to sharing stock photography under the Unsplash license. The website claims over 110,000 contributing photographers and generates more than 11 billion photo impressions per month on their growing library of over 1.5 million photos. Wikipedia