Created
September 6, 2023 18:51
-
-
Save greg-randall/8581eec1bb492d1fe107fbd17d49da8b to your computer and use it in GitHub Desktop.
Quick curl to get alt text for an image using https://alttext.ai/. Create an account to get an API key.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl https://alttext.ai/api/v1/images \ | |
-s \ | |
-X POST \ | |
--header "X-Api-Key:API-KEY" \ | |
-H 'Content-Type: application/json' \ | |
-d "$( printf "{ \"image\": { \"raw\": \"$(base64 test.jpg)\" } }" )" \ | |
| jq \ | |
| grep -i alt_text \ | |
| perl -pe 's/^[^"]*"[^"]*"[^"]*"([^"]*)".+/$1/i' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment