Skip to main content

Uses deep learning to caption img tags within a web page and fills out their alt attribute with the related caption

Project description

https://github.com/ParhamP/altify/blob/master/images/gif.gif?raw=true

Altify automizes the task of inserting alternative text attributes for image 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.

Notice: Altify will now ignore any image tag whose alt attribute has content or is just an empty string. (In compliance with standard web practices)

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

https://github.com/ParhamP/altify/blob/master/images/pic.png?raw=true

Donald Trump wearing a suit and tie

https://github.com/ParhamP/altify/blob/master/images/piano.jpg?raw=true

A piano keyboard

https://github.com/ParhamP/altify/blob/master/images/animal.jpg?raw=true

A squirrel eating

https://github.com/ParhamP/altify/blob/master/images/cat.jpg?raw=true

A close up of a cat looking at the camera

https://github.com/ParhamP/altify/blob/master/images/lady.jpg?raw=true

A woman wearing a red hat

https://github.com/ParhamP/altify/blob/master/images/lake.jpg?raw=true

A small boat in a lake surrounded by mountains

Disclaimer

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

altify-3.6.tar.gz (4.0 kB view details)

Uploaded Source

File details

Details for the file altify-3.6.tar.gz.

File metadata

  • Download URL: altify-3.6.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for altify-3.6.tar.gz
Algorithm Hash digest
SHA256 e1ba31f60df1b53dc72c4a56cc93c9d3b93087d506b4ca3ee2c2861dae395c76
MD5 d776549035c40e7ecde8ba0db4fd5da6
BLAKE2b-256 0e2f062ca7d56d9dd19d8222d0c6328a457438be4886c69b2cb197ed22d8ed56

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page