DEV Community

absterdabster
absterdabster

Posted on • Edited on

2 1

ML Model for Font Color on Website

My Final Project

I created a HTML/CSS page that allows for user input of a background color. Based on the background color that you chose, I dynamically render the page. Based on the user input, I also run a trained ML algorithm (deep neural net) using binary classification to determine the best font that would stand out from the background.

Link to Code

https://github.com/Abinavraj5427/fontColorANN

How I built it (what's the stack? did I run into issues or discover something new along the way?)

I built and constructed my neural network first using python and modules like numpy. I decided to go through the math, so I avoided ML libraries like TensorFlow. After training my model, I decided I should create an interface for users. In order to build this interface, I created a simple HTML page with dynamic CSS through JavaScript. I update real time using AJAX requests via JQuery. Then I pass the data to the server backend, PHP which runs the python script for the model via command line. Then the server responds to the user with their text color.

I never knew that PHP can run python scripts which I found was really cool. This was also one of my first times using WAMP Server to test my full-stack website.

Additional Thoughts / Feelings / Stories

I think this is a great example of how machine learning shouldn't be used. ML is not lightweight, so it cannot be used everywhere. If anything, a mathematical equation for RGB can determine the color, but I did this merely out of excitement and practice. Hope you enjoy it!

Happy Graduation Class of 2020!

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay