MDendura / altify

Uses deep learning to caption images in an HTML file and fills out its alternative text attributes with the related caption

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Altify

Image for demo

Altify automizes the task of inserting alternative text attributes for imgage tags. Altify uses Microsoft Computer Vision API's deep learning algorithms to caption images in an HTML file and returns a new HTML file in which alt attributes are filled out with their corresponding captions.

Dependencies

  • BeautifulSoup
  • Python 2.7
  • html5lib

Install and Usage (Latest Version)

1) Get a Microsoft API Key for Free

https://www.microsoft.com/cognitive-services/en-us/sign-up.

2) Install via pip

Open up terminal and enter: pip install altify

3) Use

altify path_to_your_html api_key

4) Enjoy!

A new HTML file called altify.html is created next to the HTML file you selected. (Or Desktop, when using older versions)

How It was Built

  1. Parses the html using BeautifulSoup.
  2. Find all the image tags.
  3. Stream images using uploads.im API, and then with its URL, send request to Microsoft's API to caption.
  4. Filter images that are smaller than 200px width.
  5. Fill out the alt attributes for all the images.
  6. Write an edited HTML file next to the file you selected.

Captioned Images Samples

Image for demo

Donald Trump wearing a suit and tie

Image for demo

A piano keyboard

Image for demo

A squirrel eating

Image for demo

A close up of a cat looking at the camera

Image for demo

A woman wearing a red hat

Image for demo

A small boat in a lake surrounded by mountains

Disclaimer

Humans are currently better at captioning images than machines. Use responsibly!

About

Uses deep learning to caption images in an HTML file and fills out its alternative text attributes with the related caption

License:Apache License 2.0


Languages

Language:Python 100.0%